Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Enabling/Disabling controls in a grid
Message
From
10/07/2006 19:33:22
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01135083
Message ID:
01135173
Views:
38
This message has been marked as the solution to the initial question of the thread.
>We have a grid whose record source is a view. Some of the columns are built at design time and others are added at run time.
>
>The problem we're having has to do with enabling and disabling a textbox control in column B based upon the checkbox control in column A. Clicking on the checkbox in a specific row will take care of the textbox just fine. However, when changing rows in the grid we cannot get the enabling/disabling to work reliably based on the value of the checkbox in column A within the current row.
>
>Any ideas?

Your enable/disable should be based on a field in the table. The regular way is to have two textboxes in the column, one enabled and one disabled (I've named them txtrw and txtro), so you actually wouldn't need any enabling/disabling code. Just set sparse property for that column (can't remember which value is which - try either one), and set the dynamiccurrentcontrol=[(iif(table.lField, "txtrw", "txtro"))], so if table.lField=.t. it'll use the readwrite and viceversa.

Another thing with checkboxes in a grid affecting other columns is that I've seen some delay - often it may require the checkbox to lose focus for changes to be visible. One way around it is to have code like this in checkbox.click (or checkbox.interactivechange):
nodefault
replace table.lField with not table.lfield
this.value=table.lfield
Another trick is to have this.value=this.value somewhere in checkbox's code (click, refresh, interactivechange, valid...), which somehow forces the writing of its value into its controlsource.

Try these tricks one by one, some of it should work.

Obviously, last time I had a problem like this, I tried several and now can't remember which worked and where was it :).

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