Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ReOrder by Column in a Grid
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00199665
Message ID:
00200151
Views:
13
>Thanks for the reply. I will have to digest this a bit. Do you place all the code in a class or in the header click event?

You can get by with:

1) grid logical property to indicate whether a move/resize is occurring, so you know whether to sort or not in header click, call it Sortflag, set in column moved/resize
2) a grid method for sorting, called in header click, and passed parameters of fieldname and tag to index on, set the order on, or change from ascending to descending, and sortflag

So what you need in header click is just something like

this.parent.parent.DoSort(Sortflag,table,field,tag)
It'll have all the info it needs to do its business...
DoSort looks something like:
lparameters tlSort,tcTable,tcField,tcTag

if !tlSort
  this.sortflag = .T.
  return
endif

select (tcTable)
thisform.lockscreen = .T.

if order() = upper(tcTag)
  if descending()
    set order to tcTag ascending
  else
    set order to tcTag descending
  endif
else
  index on &tcField tag &tcTag
endif

go top
this.refresh
thisform.lockscreen = .F.
The Anonymous Bureaucrat,
and frankly, quite content not to be
a member of either major US political party.
Previous
Reply
Map
View

Click here to load this message in the networking platform