Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Debugging a problem
Message
From
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:
01469770
Views:
33
>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.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform