Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sorting columns in grid not working
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00877631
Message ID:
00877645
Views:
14
This message has been marked as a message which has helped to the initial question of the thread.
Hi Chuck,

I have the same suggestion as Mike: parent.parent.refresh(). You do not need to do locate and setfocus, etc.

Also why you're using lcColor, if RGB returns numeric? It should be lnColor and assigned to 0.

>I use 4 columns in a grid to sort the displayed data. The data is suppose to be sorted by that field when the user clicks on the column header. I have the header changing colors to show that it is the sort order. Problem is I have to click on the navigation buttons or roll the mouse wheel to get the sort order to change. Is there an easy solution to this? This is the code used. The last 5 lines of code was my attemp to move the pointer so the sort order would change without using the nav buttons or mouse wheel. Thanks
>
>LOCAL nOldRec,lnPos,lcOrder,lcColor
>nOldRec = recno()
>store 0 to lnPos
>store "" to lcOrder, lcColor
>* get current text color
>WITH This
>	lcColor = .ForeColor
>	IF lcColor = RGB(128,0,128)	&& purple color 8388736
>		lcColor = RGB(0,0,0)	&& black color 0
>		SET ORDER TO
>	ELSE
>	    WITH .Parent
>	* tag is the field name - get from column controlsource
>		lnPos=RAT('.',.ControlSource)
>		lcOrder=SUBSTR(.ControlSource,lnPos+1)
>	        IF tagno(lcOrder)>0
>		   SET ORDER TO (lcOrder)
>		ENDIF
>		lcColor = RGB(128,0,128)	&& purple color
>		.Parent.clmPmtType.hdrPmtType.ForeColor = rgb(0,0,0)
>		.Parent.clmElement.hdrElement.ForeColor = rgb(0,0,0)
>		.Parent.clmAgency.hdrAgency.ForeColor = RGB(0,0,0)
>	    ENDWITH
>	ENDIF
>	LOCATE
>	.ForeColor = lcColor
>	.Refresh()
>	.parent.setfocus
>	goto nOldRec
>ENDWITH
>
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform