Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Click Event From Grid Header
Message
 
 
To
11/11/1998 10:02:10
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00156309
Message ID:
00156650
Views:
46
Scott,

Nothing jumps out as being wrong with the code you posted. As another datapoint here the code from my Grid.Reorder() method. Note there are 2 refreshes needed and the code at the bottom attempts to keep the same row position in the grid so the user stays on the record they were on through the sort order change:
lparameter pcOrder, plAscending

local i, j, llLockScreen, lnRecno, lnRelativeRow, lnDirection, lcDescending

llLockScreen = thisform.LockScreen  && prevent user from seeing all of the jumping
thisform.LockScreen = .t.

lnRecno = recno()
lnRelativeRow = this.RelativeRow
lcDescending = iif( ! plAscending, "descending", "ascending" )
set order to pcOrder &lcDescending
this.Refresh()

goto lnRecno                        && move record pointer back
this.Refresh()

if ( lnRelativeRow != this.RelativeRow )
   * the record didn't wind up at the same grid row, so we scroll the grid

   lnDirection = iif( lnRelativeRow > this.RelativeRow, 0, 1 )
   j = abs( lnRelativeRow - this.RelativeRow )
   for i = 1 to j
      this.DoScroll( lnDirection )
   endfor

   this.Refresh() && YAR
endif

thisform.LockScreen = llLockScreen
>I am having a slight problem with the index solution. If I click the header of a column to change the sorting order, it works fine the first time. When I change columns and select a different column header, it sorts using the original index and not the new column.
df (was a 10 time MVP)

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

Click here to load this message in the networking platform