Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: tvaster on January 06, 2008, 05:24:26 am

Title: Where is the OnInit code section when wxSmith is used to add new Dialog/Frame?
Post by: tvaster on January 06, 2008, 05:24:26 am
I need to set the date inside a newly opened Dialog.

I see the OnInit code section on the base frame in the xxxxApp.cpp file and that works fine on launch,  but when I use use wxSmith to create a new Dialog or Frame, there is no OnInit to be found in the new xxxx.cpp or xxxx.h files.  I can manually add it in the new "class", but it never gets called.

Can somebody point me in the right direction.  Everything else in the new Dialog works as it should. I even thought of using the Timer for this but that is certainly a waste of resources.  There must be a simpler way.

Fred V.

Title: Re: Where is the OnInit code section when wxSmith is used to add new Dialog/Frame?
Post by: wobien on January 06, 2008, 01:47:19 pm
Do you want to add code that will run when your new Dialog or Frame is launched, or code that will launch the new window?
If you mean the first, you can add your code in the constructor of the class.
Just be carefull not to add any code between
Code
//(*Initialize(xxxDialog)
and
Code
//*)
because that is the part that is managed by wxSmith.
Title: Re: Where is the OnInit code section when wxSmith is used to add new Dialog/Fram
Post by: tvaster on January 06, 2008, 07:18:51 pm
Quote
Do you want to add code that will run when your new Dialog or Frame is launched
Yes and your suggestion works fine
Thank you very much.