Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to set property of controls in INIT of the form?
Message
From
22/02/2010 14:41:14
 
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01450293
Message ID:
01450318
Views:
58
Answers in line


>Gregory, see my replied under your comments:
>
>>Dmitry,
>>
>>Your test shows or demonstrates the normal behaviour
>>
>>A couple of possibilities
>>
>>(1) Change the properties of the controls you want in the form's init. I do not see a problem there
>
>This is true. But I wanted the property set before a control's Init fires.

That is difficult - maybe addObject can


>
>>
>>(2) You could make some classes of controls to look at form properties, ie Adding properties to the form in the form's load(), then each of those controls could find out whether a certain property exists and use it in its init
>
>This is a possibility. And I already tested this approach although Naomi found some holes in it.

No holes


>>
>>(3) BindEvent the init of the controls (post flag of bindevent) to a form's method, ie
>>Change each control control class to bindEvent itself in the init to a form's method (not tested)
>>Then in the form's method you can find out what control it is and act accordingly
>
>I have never used BindEvent yet. And I am concerned that I will do something wrong (due to inexperience) and break the app. I prefer to spend some time to learn it first.

There's always a first time. It's worth the time investigating

ps: Add this to the destroy of all your control classes + form class
[ I have once read - but cannot confirm it - that the system may become unstable if you do not unbind - better safe than sorry]
try
	=UnbindEvents(m.this)
catch
	assert .f.

endtry
>So I will probably go with approach 2 unless I find other issues (on top of what Naomi already suggested).
>
>Thank you very much.
Gregory
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform