Where to put my code Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
mmvpgs
In need of some credit
In need of some credit
Posts: 8
Joined: Mon Dec 15, 2008 3:28 pm

Where to put my code

Post by mmvpgs »

Hi,

I've created an APP using wxFormBuilder, that includes some tables (used wxGrid). At this time I have the GUI code (.cpp and .h), all the Inherited classes generated and my main.cpp. Now I want to create some structures that will be updated whenever I update my tables. The problem is that I dont no where to put it in order that all my structures could be recognized in the other cpp codes.
I've tried to put it in App::OnInit() function but didn't work.

Do you have any suggestions to do it?

Note: the tables are inside Dialogs that are called from the main frame.

Thanks in advance.
radcapricorn
Experienced Solver
Experienced Solver
Posts: 70
Joined: Fri Nov 07, 2008 4:25 pm
Location: Saint-Petersburg, Russia

Post by radcapricorn »

I suggest you start with this tutorial, it could help you quite a lot.


No offense, but it's just so well not right starting on big things like wxWidgets without understanding simple things about the language itself. Now I know this forum is made to help people solve problems, but that's it. I think it's no good turning it into C++ language guide - I saw similar things happen before and nothing good came out of it. Again, by no means I intended to insult you.
win xp pro sp3/VS Express 2008/MinGW;
win Vista Ultimate/VS 2005;
Debian Lenny/gcc/cegcc-mingw32ce;
wxWidgets-2.8.9 w/wxWinCE;
spectrum
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 207
Joined: Sat Jul 21, 2007 12:17 pm

Post by spectrum »

Hi mmvpgs,

if you make wxFormBuilder to generate the cpp code, it will regenerate the code at every change on the interface and you would have to paste on it everytime back your code. This clearly will make you lose a lot of time.

I use from years wxFormBuilder, i would suggest to use a more professional way to go:

On the wxFormBuilder project, code generation -> select XRC and deselect C++.
In this way an xml file will be generated, and you can load it at run time, from YOUR own code.
There is a "xrc" sample in the "samples" foder of wxWidgets, take a look how to load the objects, is quite easy.

The macro XRCID is used for the event table, and the macro XRCCTRL to load objects.

Look also here in the forum for "XRC".

greetings
spectrum
ouch67
Earned some good credits
Earned some good credits
Posts: 135
Joined: Sun Mar 23, 2008 12:09 am

Post by ouch67 »

or you can use codeblocks: http://www.codeblocks.org/

it's got an wxWidgets form builder built into it. It changes the c++ GUI code section in your file in real time as you change the interface.

it's also got an project wizard to start a new wxWidgets project with any of the available settings you want.

It's the simplest and fastest way to use wxWidgets that I know of really...

Plus it runs on pretty much anything as it uses wxwidgets itself. ;)
NinjaNL
Moderator
Moderator
Posts: 899
Joined: Sun Oct 03, 2004 10:33 am
Location: Oosterwolde, Netherlands

Post by NinjaNL »

Or you can use wxDev-C++. It has a forum here, is actively being developed, has a Delphi like designer, the latest version will support wxAui, comes with a release version of the wxWidgets libraries, and has a thriving user base.
Follow the development of my screenplay authoring program at http://wxscreenplaywriter.blogspot.com/
mmvpgs
In need of some credit
In need of some credit
Posts: 8
Joined: Mon Dec 15, 2008 3:28 pm

Post by mmvpgs »

Thank you all for your reply, but maybe my question wasn't very clear. The application itself is already done, with no problems using wxFB. I just wanted to create a public struct with variables that save the data that is introduced in the tables of my application, in order to have the tables updated whenever they are opened. I defined a .h with these structures but I don't no where to call it in order to be recognized inside every classes of my the application.
I'll accept the second reply of this post and I'll try to find the answer myself.
Post Reply