First off, I'm new to the forum and this is my first post. So if I'm in the wrong place, please just let me know the right forum. I did read the "new users" and "read this" sticky's.
BTW, the link on
http://forums.codeblocks.org/index.php/topic,1427.0.html to the berliOS page is no good. It goes to the main page, and searching for anything to do with Code Blocks or wxSmith turns up zero results. Not sure if it's me or some other problem. I was trying to see if my issue has been filed as a bug already.
Being a new member, some background. I'm new to both C++, Code::Blocks, and wxWidgets, having started with them about 6 months ago. I've been a hobbyist programmer since the 80's, but have mostly played with variants of Basic. Most recently I spent a bit over a decade using something called XBasic, which is pretty obscure but quite powerful and fast. I've made Windows GUI programs and even dabbled with OpenGL with it. But it's so obscure it's not keeping up with the times and no one is really maintaining it anymore. My skills are leaving XBasic behind. I also have a background in electronics and currently play with the Parallax Propeller microcontroller. In fact, the program I'm currently writing is an interface to control a Propeller based project via USB.
I must say, I REALLY REALLY
REALLY like Code Blocks. It's made learning C++ and wxWidgets quite enjoyable. There's so much support out there for both that until now I have been able to google for every question or stupid programmer mistake and get moving again. I'm wishing I had switched a long time ago.
I am using CB 13.12 and wxWidgets 3.0.0 as a static build (yes, this noob managed to compile it successfully!
)
OK. On to my problem. I'm thinking it's a wxSmith problem as I'm using it to generate the GUI and it appears it may not be generating proper code. But I'm not good enough yet to figure out where the error is.
I have a program that has a main window and second window. On the second window I was using a ColourPickerCtrl button successfully. But there's things about the control I don't like, so I thought I'd try making my own by simply calling up a ColourDialog from a button event. But I am getting errors on building (detailed below) for the new frame after nothing more than adding the ColourDialog.
I am able to reduce the problem to utter simplicity:
> start a new wxWidgets project
> add a new frame (wxSmith -> add wxFrame)
> add wxColourDialog to the new frame (via wxSmith, Dialogs tab)
> compile
That's it. No other code necessary. Having the dialog on the main window works just fine. So it's something to do with adding it to a new frame. At the very least, the wxFileDialog works OK on the second window as my program already has that. So that tells me the problem may be specific to the colour dialog.
Thanks for any help.
Brian
The error log:
||=== Build: Debug in ColourDialogTest (compiler: GNU GCC Compiler) ===|
my cpp\LEDART002stuff\FTDIComms\ColourDialogTest\NewFrame.h|21|error: 'wxColourDialog' does not name a type|
my cpp\LEDART002stuff\FTDIComms\ColourDialogTest\NewFrame.cpp||In constructor 'NewFrame::NewFrame(wxWindow*, wxWindowID, const wxPoint&, const wxSize&)':|
my cpp\LEDART002stuff\FTDIComms\ColourDialogTest\NewFrame.cpp|27|error: 'ColourDialog1' was not declared in this scope|
my cpp\LEDART002stuff\FTDIComms\ColourDialogTest\NewFrame.cpp|27|error: expected type-specifier before 'wxColourDialog'|
my cpp\LEDART002stuff\FTDIComms\ColourDialogTest\NewFrame.cpp|27|error: expected ';' before 'wxColourDialog'|
||=== Build failed: 4 error(s), 0 warning(s) (0 minute(s), 8 second(s)) ===|
Here is the generated new frame's header:
#ifndef NEWFRAME_H
#define NEWFRAME_H
#ifndef WX_PRECOMP
//(*HeadersPCH(NewFrame)
#include <wx/colordlg.h>
#include <wx/frame.h>
//*)
#endif
//(*Headers(NewFrame)
//*)
class NewFrame: public wxFrame
{
public:
NewFrame(wxWindow* parent,wxWindowID id=wxID_ANY,const wxPoint& pos=wxDefaultPosition,const wxSize& size=wxDefaultSize);
virtual ~NewFrame();
//(*Declarations(NewFrame)
wxColourDialog* ColourDialog1; //******* ERROR ON THIS LINE *******//
//*)
protected:
//(*Identifiers(NewFrame)
//*)
private:
//(*Handlers(NewFrame)
//*)
DECLARE_EVENT_TABLE()
};
#endif
and the generated cpp code:
#include "wx_pch.h"
#include "NewFrame.h"
#ifndef WX_PRECOMP
//(*InternalHeadersPCH(NewFrame)
#include <wx/intl.h>
#include <wx/string.h>
//*)
#endif
//(*InternalHeaders(NewFrame)
//*)
//(*IdInit(NewFrame)
//*)
BEGIN_EVENT_TABLE(NewFrame,wxFrame)
//(*EventTable(NewFrame)
//*)
END_EVENT_TABLE()
NewFrame::NewFrame(wxWindow* parent,wxWindowID id,const wxPoint& pos,const wxSize& size)
{
//(*Initialize(NewFrame)
Create(parent, id, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE, _T("id"));
SetClientSize(wxDefaultSize);
Move(wxDefaultPosition);
ColourDialog1 = new wxColourDialog(this); //******* ADDITION ERRORS HERE *******//
//*)
}
NewFrame::~NewFrame()
{
//(*Destroy(NewFrame)
//*)
}