Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Changing controls with setfocus()
Message
From
23/08/2008 20:57:07
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
Changing controls with setfocus()
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Vista
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01341355
Message ID:
01341355
Views:
63
On my Form, I have several txtBox controls that each (on lostfocus), update the RecordSource of a single grid on the form and refresh the grid, as the ordered row order has likely changed with the txtBox change. This works fine. I have now written some code that positions the grid’s ActiveRow appropriately (mainly so the rows above ActiveRow don’t hide above the top visible row with the ActiveRow on the top row). This works fine too.

The problem is that to read the grid’s activerow position (needed to reposition the grid row content), the grid must have focus (I do this successfully in the txtBox lostfocus just before calling the grid refresh); but following the grid.refresh, I want to put the focus either back on the calling control, keypress a TAB and have it move without triggering the lostfocus event (again), or alternately put the focus back on the next control (which I was thinking of tabbing to) directly after finishing the grid’s refresh.

I started coding this, but it’s getting very very messy, and I suspect that there might be a different approach that is cleaner. Any thoughts?

Bob
Next
Reply
Map
View

Click here to load this message in the networking platform