passing a name

Started by
3 comments, last by 3dmodelerguy 19 years, 4 months ago
I am try to devlop a class the make a wxFrame have wxGLCanvas through a class function and having to problems, 1 in wxWidgets and one in general. first problem: I need to pass a name for the GLCanvas this is how you normal defina a GLCanvas:

wxGLCanvas * MyGLCanvas = new wxGLCanvas(frame, -1, wxPoint(0,0), wxSize(200,200), wxSUNKEN_BORDER, _("some text"));


what i need to do is something so that in the parameter on of the functioin i can define what i will call the wxGLCanvas ( in this case MyGLCanvas), how would i do that? second problem: I am getting this error:

Deleting intermediate files and output files for project 'Stromgage 3D Game Engine - Win32 Debug'.
--------------------Configuration: Stromgage 3D Game Engine - Win32 Debug--------------------
Compiling...
PrecompiledHeaders.cpp
Compiling...
GameWindow.cpp
MainApp.cpp
GLCanvas.cpp
C:\Stromgage 3D Game Engine\Stromgage 3D Game Engine\GLCanvas.cpp(8) : error C2664: '__thiscall wxGLCanvas::wxGLCanvas(class wxWindow *,int,const class wxPoint &,const class wxSize &,long,const class wxString &,int *,const class wxPalette &)' : cann
ot convert parameter 1 from 'class wxWindow' to 'class wxWindow *'
        No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
Generating Code...
Error executing cl.exe.

Stromgage 3D Game Engine.exe - 1 error(s), 0 warning(s)


with this code GLCanvas.h:

#ifndef GLCANVAS_H
#define GLCANVAS_H

#include "PrecompiledHeaders.h"
#include <wx/glcanvas.h>

class GLCanvas
{

	public: 
		
		GLCanvas( wxWindow &frame, int &var, wxPoint &point, wxSize &size, wxString &title );

};




#endif

GLCanvas.cpp:

#include "PrecompiledHeaders.h"
#include "GLCanvas.h"
#include <wx/glcanvas.h>

GLCanvas::GLCanvas( wxWindow &frame, int &var, wxPoint &point, wxSize &size, wxString &title, const char &canvasname )
{

	wxGLCanvas * canvasname = new wxGLCanvas( frame, var, point, size, title);

}


can anyone help me with this error?
Advertisement
In the "GLCanvas.cpp", use:

wxGLCanvas * canvasname = new wxGLCanvas( &frame, var, point, size, title);

Instead. You need to pass in the address of, and you were not. That should work. If not let me know. Best of luck!

- Drew
now i get this error:

Deleting intermediate files and output files for project 'Stromgage 3D Game Engine - Win32 Debug'.--------------------Configuration: Stromgage 3D Game Engine - Win32 Debug--------------------Compiling...PrecompiledHeaders.cppCompiling...GameWindow.cppGLCanvas.cppC:\Stromgage 3D Game Engine\Stromgage 3D Game Engine\GLCanvas.cpp(8) : error C2664: '__thiscall wxGLCanvas::wxGLCanvas(class wxWindow *,int,const class wxPoint &,const class wxSize &,long,const class wxString &,int *,const class wxPalette &)' : cannot convert parameter 5 from 'class wxString' to 'long'        No user-defined-conversion operator available that can perform this conversion, or the operator cannot be calledMainApp.cppGenerating Code...Error executing cl.exe.Stromgage 3D Game Engine.exe - 1 error(s), 0 warning(s)
Well you need to check the parameters you are sending -

You have:
wxGLCanvas * MyGLCanvas = new wxGLCanvas(frame, -1, wxPoint(0,0), wxSize(200,200), wxSUNKEN_BORDER, _("some text"));

Parameter 5 in this case is wxSUNKEN_BORDER and it is expecting a wxString per:

GLCanvas( wxWindow &frame, int &var, wxPoint &point, wxSize &size, wxString &title );

You will need to make the parameter lists match - such as

GLCanvas( wxWindow &frame, int &var, wxPoint &point, wxSize &size, DWORD &style, wxString &title );
hey thanks i forgot about how to send a long string, DWORD.

This topic is closed to new replies.

Advertisement