Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sorting Grids
Message
From
18/11/1997 11:43:34
 
 
To
18/11/1997 05:35:05
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00060668
Message ID:
00060940
Views:
25
>>Greetings All
>>I have created a grid subclass that includes a custom method to sort on a columns control source when the user clicks on the grid header. The method simply checks for the existence of an index key expression on the field selected, and if the key exists, sets the order of the grid's resordsource with a SET ORDER TO. The method works fine, however, an unfortunate behavior was that the row selected in the grid prior to clicking on the column header and calling the method was no longer the selected row after the grid was re-ordered. I am not moving the record pointer in the sort method and verified that RECNO() was the same before and after re-ordering. However, the grid's ActiveRow property would be changed. I have eliminated this behavior by adding code to the sort method to set the focus off the grid, prior to issuing the SET ORDER TO command, and then re-setting the focus to the grid with This.SetFocus(). Can anyone explain to me why this is necessary? I have seen several references
>>already to situations where things don't behave as expected if the focus happens to be on a grid. Can anyone give me some insight regarding special circumstances pertaining to grids? Under what conditions is it necessary to move the focus off the grid in code in order to accomplish something, or what 'strange' behaviors can occur simply by having the focus in a grid. I would also appreciate code examples for sorting a grid by clicking on the column header.
>>Thanks In Advance
>>Bill Sabo
>
>Hello Bill,
>
>in some cases like that can help to set ThisForm.LockScreen = .T., Set orders
>and set back ThisForm.LockScreen = .F.
>
>Petr Valach

Hello Petr,
Thanks for the advice. I'll try leaving the focus on the grid, and locking the screen instead.
Bill
Previous
Reply
Map
View

Click here to load this message in the networking platform