Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Dynamically swapping controls
Message
From
20/02/2003 14:54:31
Leo Kool
Agis Automatisering BV
Harmelen, Netherlands
 
 
To
20/02/2003 13:39:12
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00755661
Message ID:
00755702
Views:
9
Hi Michael,

The Column objects of an Grid have an "DynamicCurrentControl" property in wich you can place an expression that evaluates to an expression wich is one of your control names in your column, and is re-evaluated when you refresh your grid.
Note that you have to set the "Sparse" property to .F. to let ik work.

Here is an example that I used to display a button for memofields in an Grid. The button has a normal color when the memofield is empty, and is blue when there is something in the memofield.
For Each loColumn In ThisForm.Grid1.Columns
	*!* some non interesting code...
	If lcField = "M"
		With loColumn
			.AddObject("cmdMemoEdit1", "ccmdMemoEdit")
			.AddObject("cmdMemoEdit2", "ccmdMemoEdit")
			.cmdMemoEdit1.ForeColor = Rgb(0, 0, 255)
			.DynamicCurrentControl = "Iif(!Empty( " + lcFieldName + "), 'cmdMemoEdit1', 'cmdMemoEdit2')"
			.Sparse = .F.
			.CurrentControl = "cmdMemoEdit1"
			.cmdMemoEdit1.Visible = .T.
			.cmdMemoEdit2.Visible = .T.
			.cmdMemoEdit1.Height = .Text1.Height
			.cmdMemoEdit2.Height = .Text1.Height
			.Width = 50
			.RemoveObject("Text1")
		EndWith
	EndIf
	*!* some non interesting code...
EndFor
hth,
Leo
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform