Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
#define
Message
From
18/04/2018 15:33:04
 
 
To
17/04/2018 11:57:22
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 10
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01659466
Message ID:
01659528
Views:
74
must always test code especially when its a trap as evaluated complex expression in dynamicBackcolor/dynamicForecolor.
when tested vfp can return error (on dynamicForecolor here) or dont work at all and dont retrieves error.

this is a code to solve your problem .


*i just changed colors (for eyes)
PUBLIC oform
oform=NEWOBJECT("yDynamF")
oform.Show
RETURN

DEFINE CLASS yDynamF AS form
	Top = 0
	Left = 0
	Height = 374+200
	Width = 782+100
	Caption = "Form1"
	Name = "form1"

	ADD OBJECT grid1 AS grid WITH ;
		Anchor = 15, ;
		Height = 336+200, ;
		Left = 0, ;
		Top = 0, ;
		Width = 780, ;
		Name = "Grid1"

	ADD OBJECT command1 AS commandbutton WITH ;
		Top = 348+200, ;
		Left = 244, ;
		Height = 24, ;
		Width = 144, ;
		FontBold = .T., ;
		Anchor = 768, ;
		Caption = "Test_dynamicForecolor", ;
		MousePointer = 15, ;
		Name = "Command1"

	PROCEDURE Init
		thisform.addproperty("nRecno",5)  &&to be synchro with asker
		
	ENDPROC

	PROCEDURE grid1.Init
		sele * from home(1)+"samples\data\customer" into cursor ycurs
		with this
		.recordsource="ycurs"
		.recordsourcetype=1
		.gridlines=0
		.deletemark=.f.
		locate
		.refresh
		endwith
	ENDPROC

	PROCEDURE command1.Click
		#DEFINE ACTIVEROWFORECOL		255                 && red
		#DEFINE ROWFORECOL			16711680       && blue
		local m.x  &&must be a character expression to evaluate dynamically
		m.x='IIF( RECNO(thisform.grid1.RecordSource) ='+trans(thisform.nRecno)+','+trans(ACTIVEROWFORECOL)+','+trans(ROWFORECOL)+')'
		Thisform.grid1.SetAll( 'DynamicForeColor',m.x , 'COLUMN' )
		thisform.grid1.refresh
	ENDPROC

ENDDEFINE
*
*-- EndDefine: yDynamF
Previous
Reply
Map
View

Click here to load this message in the networking platform