Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Iif(mod(recno()/2)=0,rgb(),rgb()) doesn't work
Message
 
À
20/11/2007 06:02:32
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01270108
Message ID:
01270203
Vues:
26
Kouakou,

This is some prototype code from Carlos Alloatti that works well no matter the order, a little bit flickery thou.
PUBLIC oform1

oform1=NEWOBJECT("form1")
oform1.Show
RETURN


	**************************************************
*-- Form:         form1
*-- ParentClass:  form
*-- BaseClass:    form
*-- Time Stamp:   10/16/07 03:57:05 PM
*
DEFINE CLASS form1 AS form


	Top = 0
	Left = 0
	Height = 253
	Width = 394
	DoCreate = .T.
	Caption = "Form1"
	cellbackcolor = .F.
	Name = "Form1"


	ADD OBJECT command1 AS commandbutton WITH ;
		Top = 216, ;
		Left = 300, ;
		Height = 27, ;
		Width = 84, ;
		Anchor = 12, ;
		Caption = "Command1", ;
		Name = "Command1"


	ADD OBJECT grid1 AS grid WITH ;
		Anchor = 15, ;
		DeleteMark = .F., ;
		GridLines = 0, ;
		Height = 200, ;
		Left = 12, ;
		ReadOnly = .T., ;
		RecordMark = .F., ;
		Top = 12, ;
		Width = 372, ;
		Name = "Grid1"


	PROCEDURE setcellbackcolor
		Lparameters pnFirstCol As Integer

		If pnFirstCol = 1 Then
			This.CellBackColor = Not This.CellBackColor
		Endif

		If This.CellBackColor
			Return Rgb(255,255,225)
		Else
			Return Rgb(192,192,192)
		Endif
	ENDPROC


	PROCEDURE refreshcellbackcolor
		Thisform.CellBackColor = .F.

		Thisform.Grid1.SetAll("DynamicBackColor", "Thisform.SetCellBackColor(0)", "Column")
		Thisform.Grid1.Columns(Thisform.Grid1.LeftColumn).DynamicBackColor = "Thisform.SetCellBackColor(1)"
		Thisform.Grid1.Refresh
	ENDPROC


	PROCEDURE Load
		Use Home(2) + "data\orders"
	ENDPROC


	PROCEDURE command1.Click
		Thisform.RefreshCellBackColor()
	ENDPROC

	procedure grid1.scrolled
		LParameters tnDirection
		Dodefault(tnDirection)
*		if tnDirection > 3 && Horizontal scrolling?
			thisform.refreshCellBackColor()
*		endif && Is better to do it regardless, for if you scroll with the wheel is necessary
	endproc
		


	PROCEDURE grid1.AfterRowColChange
		Lparameters nColIndex
		Thisform.RefreshCellBackColor()
	ENDPROC

	PROCEDURE grid1.Init
		local loColumn
		
		for each loColumn in this.Columns
			Bindevent(loColumn, 'Resize', thisform, 'RefreshCellBackColor')
		endfor
		Thisform.RefreshCellBackColor()
	ENDPROC




ENDDEFINE
*
*-- EndDefine: form1
**************************************************
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?

"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare

"To die for a religion is easier than to live it absolutely"
Jorge L. Borges
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform