Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to programmatically change active cell in grid
Message
From
01/11/2012 16:50:38
 
 
To
01/11/2012 15:47:59
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01556284
Message ID:
01556288
Views:
57
>Hi,
>
>I am working on a class that freezes columns on left side of a grid in a way similar to how Excel does it. Thanks to help from Dragan, the class works fine when user uses scroll bar. When user tabs into one of the frozen columns I want behavior to be same as when scrolling with the exception that the active cell is changed to the first unfrozen cell to the right. I haven't been able to do this last part.
>
>I try to do it with code in afterrowccolchange that programmatically scrolls grid to the left with DOSCROLL(5), thus picking up previously implemented behavior. After that I issue a couple of KEYBOARD '{TAB}' PLAIN CLEAR, using flags to avoid additional doscroll()s as afterrowccolchange is reentered. VFP does not respond at all to the KEYBOARD commands. BTW, when VFP does DOSCROLL() it reduces RelativeColumn by one, while keeping ActiveColumn the same value, which may be part of the problem. What I really want to do is to change both RelativeColumn and ActiveColumn to the desired value, but don't know how.
>
>Any suggestions? TIA,
>
>Alex
Not sure if this will work for you but I've done something similar......

I simply return FALSE from the when method of all the frozen column data control. If the user TABs or ARROWs into the cell s/he will wind up in either the first or last unfrozen cell (depending on the direction of the arrow key).

In my case, the user can click in one of the frozen cells. Up/Down arrows change the record but stay in the same column.

........Rich
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform