Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Changing controls with setfocus()
Message
From
24/08/2008 23:24:30
 
 
To
24/08/2008 22:38:51
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Vista
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01341355
Message ID:
01341427
Views:
16
>>Your suggested approach is quite similar to what I had started trying. The key from your post was that there is no magic bullet solution, so you got me back to work on the problem. It’s working now, and here’s what I ended up with:
>>
>>A global (public) variable gcCameFrom
>>
>>For each txtBox, or other control, that changed the grid’s RecordSource content
>>In GotFocus()
gcCameFrom = This.Name
>
>Except that this.name is relative to .parent; if you have instantiated a same composite class several places - say, a container with two or three textboxes to enter phone number, area code, internat country code etc - the members of that container will have the same names in every instance, names you can't change.
>
>I'd suggest
gcCameFrom=sys(1272, this)
>
>which would give you full hierarchy, or even
>
>
goCameFrom=this
>
>as a direct object reference, but in that case you'd have to make sure you clear that when your form loses focus.

Dragan
Using "this" was my initial approach, but I couldn't figure out how to use it to setfocus. With gcCameFrom = this.name ... I use
with thisform
.&gcCamefrom..setFocus()
but this syntax doesn't work with goCameFrom = this when I use ...
with thisform
.&goCameFrom..setfocus()
I get a syntax error. What would be the right syntax to do a setfocus() for goCameFrom?

Bob
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform