Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
A Good Grid
Message
From
24/12/2001 16:54:02
 
 
To
24/12/2001 16:06:02
John Marrone
Bloodstock Research Inc.
Lexington, Kentucky, United States
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Title:
Miscellaneous
Thread ID:
00597988
Message ID:
00597997
Views:
16
Hi jOHN.

>> Does anybody know of a good grid, 3rd party that will let you sort by
clicking on the header, and sort either way. I used true DBGrid with VB
and found it to be very nice. Is there something for vfp avilable somewhere. <<

You do not need a third party control to do this. All you need to do is have this code in the header's click methos:
WITH This.Parent
  IF PEMSTATUS( .Parent, 'SetOrder', 5 )
    .Parent.SetOrder( JUSTEXT( .ControlSource ) )
  ENDIF
ENDWITH		
This code in the grid's SetOrder() method:
LPARAMETERS tcTag
LOCAL lnRecNo, laTags[ 1 ]
*** Make sure a valid tag name was passed
IF ! EMPTY( tcTag )
  *** Make sure we have the procedure file loaded so we can access the
  *** IsTag() function
  SET PROCEDURE TO Ch06 ADDITIVE
  WITH This
    *** Make sure it really is a tag for the grid's RecordSource
    *** Get all open indexes for the specified table
    ATagInfo( laTags, "", .RecordSource )
    IF ASCAN( laTags, tcTag, -1, -1, 1, 7 ) > 0 
      lnRecNo = RECNO( .RecordSource )
      *** Go ahead and set the order for the table
      SELECT ( .RecordSource )
      SET ORDER TO ( tcTag )
      IF lnRecNo # 0
        GO lnRecNo IN ( .RecordSource )
      ENDIF
      .SetFocus()
    ENDIF
  ENDWITH					
ENDIF

Previous
Reply
Map
View

Click here to load this message in the networking platform