Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to set property of controls in INIT of the form?
Message
 
 
To
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:
01450322
Views:
50
Gregory,

If this were 40 years ago I would right away jump to every suggestion (or idea) brought about and start coding. But now that I am older and wiser (some may disagree though) I am thinking of all possibilities and mainly about creating a maintenance nightmare (which I am very good at). There is one more option that we didn't discuss; I could say to customer, Sorry, I can't do it. I am learning to say No; it is a work in progress and painful but in the end very rewarding <g>.

I will consider, of course, everything you suggest. Thank you very much!

>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.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform