Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Focus / Activate
Message
 
 
To
23/01/2004 16:39:17
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00869739
Message ID:
00870420
Views:
27
David,

What are the datasessions of your forms?

I just did some tests and by form.LostFocus() or form.Deactivate() time thisform.ActiveControl has already been invalidated.

So I thought about approaching it another way of checking what the current alias() was on the way out of the form, but at deactivate time VFP has already set the current workarea to the same workarea that was selected at the end of the form.Load(). For example in form.Load I created two cursors X1 and X2. X1 had one row and it's columns were bound to textboxes. X2 had several rows and was bound to a grid. I made sure that X1 was the current alias at the end of the method. Then in deactivate I tested the current alias, but it was always x1 even if the grid was the control with focus at the time I clicked to another window.

If x2 was the selected alias at the end of Load, that was the workarea that remained selected regardless of where I tried to setfocus.
* form.Deactivate()
if ( alias() = "X2" )
*   thisform.text1.SetFocus() && - doesn't change to x1
*   debugout "change to text1"
   select x1 && this will alter workareas
endif
the above code will in fact make sure that the grid workarea is not selected as the form loses focus.

So that brings me to the question about what sort of data sessions your forms in question are using.

>The other form could really be anything, menu options, buttons, events whatever. So I don't believe there's any generic way other than the firing of lostfocus or deactivate. Can't even guarantee lostfocus because a form with empty (unpopulated record source) grid doesn't get focus.
>So it leaves "deactivate" - but that's too late.
>I guess i'm kinda stuck for a generic solution. I can certainly change focus away from a grid or other data bound control if an option is selected which I "know" is going to cause alias problems. I can even store that object reference in a form property so that when it activates I can reset to the original.
>I was kinda hoping that since VFP clearly knows and remembers the active control (even though form.activecontrol returns nothing) that there would be another way to access it. I summary, what I'd really like to do is change the activecontrol on a form that isn't active or is about to become inactive. But I guess that would create ALL sorts of issues with events firing. Oh well :-(
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform