Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Checkbox in grid dynamically change the caption
Message
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
01686606
Message ID:
01686630
Views:
37
>Hi,
>
>I have a grid build from a DBF table. One of the columns is set to the value "STATUS='A'". This resolves into .T. or .F.
>I want to shows this in the grid as a check box. And I can dynamically replace the column from text to the check box as follows:
>
>.RemoveObject( "Text1" )	
>cNewControlName = "." + ALLTRIM( GRID_DATA.OPT_CONTR1 )
>.AddObject( ALLTRIM( GRID_DATA.OPT_CONTR1 ), ALLTRIM( GRID_DATA.OPT_CONTR2 ) )			
>.sparse = .F.
>
>The value in OPT_CONTR2 is "CHECKBOX_CONTROL"
>The value in OPT_CONTR1 is "STATUS" (or whatever word I choose).
>The PRG has a function "CHECKBOX_CONTROL" which simply looks like this:
>
>DEFINE CLASS CHECKBOX_CONTROL AS CHECKBOX
>
>	OPT_CONTR1 = ""
>	OPT_CONTR2 = ""
>	OPT_CONTR3 = ""
>	OPT_CONTR4 = ""
>	OPT_CONTR5 = 0.00
>	OPT_CONTR6 = ""
>	OPT_CONTR7 = .F.
>	OPT_CONTR8 = .F.
>	ROW_HEIGHT = 0.00
>						
>ENDDEFINE
>
>The above shows all rows in the grid as a checkbox. However, regardless of the value (STATUS="A" or STATUS="I"), the check box has a caption equal in OPT_CONTR1. If the value in OPT_CONTR1 is "STATUS", all rows show the checkbox with the caption STATUS.
>I would like the caption to change, depending on the value in the field STATUS. For example, when the STATUS="A", the caption should say "Active". When the value in the row is STATUS="I", the caption should say "Inactive."
>
>How do I do it?
>
>TIA

I decided that the simplest approach is to remove the Caption all together and leave just the check box. The checked box will indicate Active and the unchecked box will indicate Inactive.

Thank you all for your input and help!
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Reply
Map
View

Click here to load this message in the networking platform