Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Subclassing headers
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00163637
Message ID:
00163732
Vues:
28
Michelle,

>Ah, this is the part I was missing. So you can say "as header" if you do it in code. I thought you guys meant I had to make a custom class that was the same as a header. This makes more sense. Sometimes I miss the obvious. :)
>
>What's all that arrow business about in your code?

It's an indicator arrow like in Outlook Express that shows the current sort direction.
**************************************************
*-- Class:        lblheaderarrow (e:\vfp5app\ccontrol.vcx)
*-- ParentClass:  clabel (e:\vfp5app\ccontrol.vcx)
*-- BaseClass:    label
*
DEFINE CLASS lblheaderarrow AS clabel


	AutoSize = .F.
	Caption = ""
	Width = 16
	*-- mcColumnName - name of the column the arrow is in
	mccolumnname = ""
	*-- mcDown - character used to point down
	mcdown = ""
	*-- mcUp - character used to point up
	mcup = ""
	*-- mcGridName - name of the grid this arrow is attached to
	mcgridname = ""
	Name = "lblheaderarrow"


	*-- SetPosition - set the arrow position
	PROCEDURE setposition
		local loGrid, loCol

		loGrid = eval( this.mcGridName )
		for each loCol in loGrid.Columns
		   if ( loCol.Name == this.mcColumnName )
		      with this
		         .Caption = iif( loCol.Header1.mlAscending, .mcUp, .mcDown )
		         .Top = objtoclient( loCol.Header1, 1 ) + 2
		         .Left = objtoclient( loCol.Header1, 2 ) + objtoclient( loCol.Header1, 3 ) - .Width
		         .Visible = .t.
		      endwith
		      exit
		   endif
		endfor
	ENDPROC


	PROCEDURE Init
		lparameter pcGridName

		local laFonts[1]

		afont( laFonts )
		with this
		   if ( ascan( laFonts, "Wingdings 3" ) > 0 )
		      .FontName = "wingdings 3"
		      .mcUp = 'p'
		      .mcDown = 'q'
		   else
		      .FontName = "wingdings"
		      .mcUp = chr(225)
		      .mcDown = chr(226)
		   endif
		   .FontBold = .t.
		   .ForeColor = ColorFactor( this.parent.BackColor, 0.5 )
		   .Caption = ""
		   .mcGridName = pcGridName
		   .MousePointer = 99
		   .MouseIcon = "down.cur"
		endwith
	ENDPROC


	PROCEDURE Click
		* pass the click onto the Header

		local loCol

		loCol = eval( this.mcGridName + "." + this.mcColumnName )
		loCol.Click()
	ENDPROC


ENDDEFINE
*
*-- EndDefine: lblheaderarrow
**************************************************
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform