Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Debugging a problem
Message
 
 
To
19/06/2010 14:31:59
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01469670
Message ID:
01469791
Views:
32
>>I finally figured what causes the problem I am having. It is the value of the form BindControls property. If this values is .T. (thisform.BindControls = .T.) the combobox fails if the RowSource has value. But if the BindControls is .F. there is no problem. Keep in mind that it does not matter if the combobox has ControlSource entry or not. Now that I know how to deal with this problem I will have to find a way around it.
>
>.BindControls=.t. was the default always, even before it existed. It was introduced as a chance to do exactly what you were trying to do - to have the creation of cursors deferred to .init() of various controls, instead of putting everything in the form's .load(). With .BindControls=.f. you can add your controls with controlsources (rowsources etc) set in advance, and these wouldn't be checked nor actually bound until you issue .BindControls=.t.
>
>Still, it's not perfect. Assume you had a bunch of controls, bound them and then added (at runtime) another bunch of controls (say, a container in an extra page on a pageframe), instantiated on demand. What if its cursors aren't open already? Setting .BindControls=.t. works only once; that's been spent already.
>
>The only trick I found efficient is to have a function call in a property of the container being added. Since I wanted to have a bizobject (one per such container), the function was returning the bizobject. Properties are evaluated before any inits run, so I used that to have my code (the init of the bizobject) run _before_ any of the controls are instantiated.
>
>This is, of course, a bit off your topic, but I figured it may shed some light.

Thank you for both of your messages. I am considering if I will be setting up the value of RowSource property in the INIT method of deal with it via BindControl value. Not very difficult decision since either approach will solve my issue.
"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
Reply
Map
View

Click here to load this message in the networking platform