Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Checkbox value in grid
Message
From
23/09/1998 19:50:27
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00139017
Message ID:
00140113
Views:
25
>I have a grid that is a checklist. It has two columns: the thing to be done and the check off. The values for the check column come from a character field in another table consisting of T & F. Each thing to be done has a key, and that key number translates to the position in the character string.
>
>For the checkbox, I made the control source:
>
>IIF(SUBSTR(repairview.ccheck,chkkey,1)="T", .T., .F.)
>
>This worked great for displaying the checklist. The problem came when I tried to un/check something. Having a calculated control source seems to make the checkbox read only. Obviously, it's not going to know how to change the value in the string, so I put code for that in the click event. But if I click on the checkbox, it just beeps and doesn't do the click event.
>
>So I set the control source to none, and put "this.value = " plus the IIF above in the refresh event. Unfortunately, it doesn't work dynamically. It takes the result of the first item on the checklist and puts that for all of them.
>
>Is there a way to set the value dynamically without using the control source?

You should try to change the value of the underlying field/expression... mmmm, let's try this in your check.click:

Local lcNewValue
lcNewValue=ChrTran(SUBSTR(repairview.ccheck,chkkey,1), "FT","TF")
replace repairview.ccheck with stuff(repairview.ccheck, chkkey,1, lcNewValue)
this.refresh
nodefault

Things may go odd if the value of ChkKey is !betw(chkkey,1, len(repairview, ccheck)), but then you'd be in trouble as soon as you'd try to display the checkbox, far before ever getting to click it, so I guess there's no need to check it now.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform