Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Disabling input on one row of a grid
Message
From
03/07/1997 16:02:15
 
 
To
03/07/1997 13:02:08
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00038531
Message ID:
00038598
Views:
34
>>I know I should be able to figure this out on my own...brainlock again...
>>
>>I have a grid whose record source is a view of a table containing billing records. The grid columns contain text boxes and option groups. If the value in the date_billed column is empty, the item has not been billed and the user should be allowed to change values in all the other columns for that record. If there's a value in date_billed, the bill has been sent and user cannot edit anything in that record. The user should get a dialog box explaining why the record cannot be edited.
>>
>>My question is, where to put the code to test for the value in date_billed, and what properties to set to disable editing in that row? I've experimented with code in the InteractiveChange method of each control, but that seems like too much code and the results are not exactly what I want. (For example, setting the readonly of a text box to true works fine--it affects only the current record-- but there is no readonly property for an optiongroup, and enabled = .f. affects all the rows.)
>>
>>Is there something I can do at the grid level? Something tells me that I should use the AfterRowColChange event to test the value of date_billed, but I'm unsure what properties to set.
>>
>>Sorry for the long description. Thanks,
>>
>>Ross
>
>I guess this is case for DynamicCurrentControl property. For example you put two different option group (enabled/disabled) into appropriate column and toggle them automatically depending on DynamicCurrentControl expression which evaluates date_billed value. You can look at DynamicBackColor example from 'Knowledge Base' to get hints how to use Dynamic properties in general.


Looks like the DynamicCurrentControl is the better solution. If I return .f. from When, focus jumps to the next grid column, which fires its When and gives the user the same dialog box again, and so on. I can't call SetFocus from a When to avoid this. (I think in 2.6 I used to return an integer instead of .f. to send focus to a particular control, but I don't know how VFP would support this). I think I'll use When without a dlog box until I master DynamicCurrentControl.

Thanks to you both!
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform