Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sort Grid by Column?
Message
From
10/02/1999 12:26:38
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00185978
Message ID:
00186066
Views:
17
>Nancy,
>Ed said in his reply that you can't subclass headers. Do you know this to be false?
>Rich.
>
>>Hi, Nigel-
>>This may qualify as "too much code," but could you add a method called sort() to your grid (or subclass the grid header). In the header's click you could call the method. Then the method could first look for an index for the controlsource. If there isn't one create a dynamic index and set order to it?
>>
>>HTH
>>
>>>>>Is there any way to display a grid sorted by column - dynamically.
You could subclass headers and even add to a vcx but cannot process visually. ie: also regarding to Nigel's queston :
* grid.init (A grid class with gettag method)
set classlib to myheader.prg additive
   for each oColumn in this columns
 	with oColumn
	tcCaption = field(ix) && Real implementation has more code here
&& Getting caption from dbc
	if type(".Header1") = "O"
     		.removeobject("Header1")
 		.addobject("MyHeader1","myMSelHeader",tcCaption)
 	else	
     		.MyHeader1.caption = tcCaption
 	endif	
*        .Myheader1.tagname = this.gettag(.controlsource)
	endwith
    endfor

*myheader.prg
define class myMSelHeader as header
        tagname=""
	procedure init
		lparameters tcCaption
		this.caption = tcCaption
		this.alignment = 6
	endproc
	procedure click
		if !empty(this.tagname)
			set order to tag (this.tagname)
		else
			set order to 0	
		endif
		nTempCurrec = recno()			
		this.parent.parent.refresh
		go nTempCurrec
	endproc
enddefine
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform