TControl:Hide() works but only if you call it after the TDialog has been activated. I wanted to include some TButtons that were hidden from the start. Is there a way of doing this?
As a reasonable workaround I figured I could call a function to hide these buttons when the TDialog was activated (like an ONINIT option). However I discovered that whilst TControl has a bInit DATA, the bInit code block is not called on Activation but is called on the resize event. This may mean that it would be called if the TDialog was activated MAXIMISED or CENTERED - I haven't tested for that. It isn't called if the TDialog is merely activated. There is code so that bInit can only be called once so I presume it was intended to be called when the TDialog is activated.
I did get things going by adding a bStartUp DATA and inserting the following code into TDialog:Activate() after ::Show() and before ::WinRun()
- Code: Select all Expand view RUN
IF ::bStartUp != nil
EVAL( ::bStartUp )
ENDIF
I haven't included code to reset bInit to nil because I figure that TDialog:Activate() will only get called once. I'm not sure if transferring bInit to this place in the code is a perfect solution to ensuring that the initialisation code block is run - depending upon what are the consequences of having initialisation code before WinRun(). (That assumes that the RESIZE event fires after or during WinRun() and not before - something I haven't tested.) But you might want to look into the best way of having TDialog initialisation code firing however the TDialog is activated.
Regards
Doug
(xProgrammer)