I have a grid containing the names and addresses of contacts.  In the click
event of 3 of the headers, Contact no, Surname and Postcode, I have put some
code to set the order to that column; a second and subsequent clicks change
the order from ascending to descending and back again.  An arrow is
displayed to show if it is ascending or descending.  If I click on a row in
the grid then click on the header the record pointer jumps to an apparently
random record.  Clicking on the header a second time to change direction
causes the record pointer to jump to another random record.  Subsequent
clicks cause the record pointer to jump between these two records.  The
AfterRowChange event does not fire.  I've tried using SET STEP ON but then
it behaves perfectly :-)

The code in the Surname header is shown below:

IF ORDER() <> 'SURNAME'
        SET ORDER TO Surname ASCENDING 
        *&* Reset everything to default values
        WITH ThisForm.grdContacts
                .SetAll('FontBold',.F.,'Header')
                .SetAll('Picture','','Header')
        ENDWITH 
        *&* Set this header as required
        This.FontBold = .T.
        This.Picture = 'Up.BMP'
        This.Parent.Autofit
ELSE
        IF DESCENDING()
                *&* set ascending
                SET ORDER TO Surname ASCENDING 
                This.Picture = 'Up.BMP'
        ELSE
                *&* set descending
                SET ORDER TO Surname DESCENDING 
                This.Picture = 'Down.BMP'
        ENDIF 
ENDIF

ThisForm.Refresh 

Any suggestions would be gratefully received as this has me baffled!

Regards

John

John Weller
01380 723235
07976 393631




_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to