User forums > Using Code::Blocks

Where is the OnInit code section when wxSmith is used to add new Dialog/Frame?

(1/1)

tvaster:
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.

wobien:
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)
--- End code ---
and

--- Code: ---//*)
--- End code ---
because that is the part that is managed by wxSmith.

tvaster:

--- Quote ---Do you want to add code that will run when your new Dialog or Frame is launched
--- End quote ---
Yes and your suggestion works fine
Thank you very much.

Navigation

[0] Message Index

Go to full version