Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Highlight Row in a Grid
Message
De
25/03/1998 10:57:20
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00086976
Message ID:
00087007
Vues:
44
>I am highlighting rows in my grids using the DynamicBackColor property and updating this value in the AfterRowColChange event. This works great, however I was wondering if there was a way to make the entire row look highlighted. Right now one cell within the row always "looks" selected.
Hi Paul,
You can try following class :
**************************************************
*-- Class:        highlighted (c:\temp\test.vcx)
*-- ParentClass:  grid
*-- BaseClass:    grid
*
DEFINE CLASS highlighted AS grid

	Height = 200
	Width = 320
	ccurrecbackcolor = (RGB(255,255,0))
	ccurrecforecolor = (RGB(0,0,255))
	lingrid = .T.
	ncurrec = .F.
	Name = "highlighted"

	PROCEDURE AfterRowColChange
		LPARAMETERS nColIndex
		this.nCurRec = recno(This.RecordSource)
		thisform.LockScreen = .F.
		IF !this.lInGrid
			this.refresh()
		ENDIF
	ENDPROC

	PROCEDURE BeforeRowColChange
		LPARAMETERS nColIndex
		thisform.LockScreen = this.lInGrid
	ENDPROC

	PROCEDURE Init
		WITH this
			IF !empty(.RecordSource)
				.nCurRec = recno(this.RecordSource)
				.SetAll("DynamicBackColor", "IIF(RecNo(This.RecordSource) = This.nCurRec," + ;
					str(this.cCurRecBackColor)+","+str(this.BackColor)+")", "Column")
				.SetAll("DynamicForeColor", "IIF(RecNo(This.RecordSource) = This.nCurRec," + ;
					str(this.cCurRecForeColor)+","+str(this.ForeColor)+")", "Column")
			ENDIF
		ENDWITH
	ENDPROC

	PROCEDURE Valid
		this.lInGrid = .F.
	ENDPROC

	PROCEDURE When
		this.lInGrid = .T.
	ENDPROC
ENDDEFINE
*
*-- EndDefine: highlighted
**************************************************
To follow rec pointer movement from outside of grid, set grid.nCurrec property and call grid.refresh.
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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform