Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Enabling and disabling rows/columns in a Grid
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Enabling and disabling rows/columns in a Grid
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP1
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
00960928
Message ID:
00960928
Views:
46
Hi Everyone,
I'm running into a problem trying to enable/disable a column in a grid. I'm using a custom property of the grid to hold an expression that I evaluate to tell me whether the grid should be enabled/disabled. I call the property "DynamicRowEnabledExpression."

For the most part, the code seems to work fine. i.e. When I move to a row that should be disabled, it is. All controls in that row are disabled. I can't select anything from the combo boxes, checkboxes etc. However, when I first move from a disabled row to one that should be enabled, the controls in the row still seem to be disabled. Even though the Enabled property of the column with the focus has its enabled property set to .T. (I checked) and so does the current control for that column, the control acts as though its disabled (i.e. you cannot type into or select a value from a combo box or change a value of any control in any way). Interestingly, if I move to another column in that same row, it is enabled and when I move back, so is the one I just left.

As I said, I don't run into the same problem when moving from an enabled row to one that should be disabled. It IS disabled as it should be - from the moment I first click into it.

Am I missing something? Is there some reason that a control would not be enabled even if its Enabled property is set to .T. (Incidently, for those who may be wondering, I've also checked the ReadOnly property which I am not setting. It is set to .F. as it should be.)

Any thoughts would be appreciated. I'm sure it's something simple that I'm overlooking.

John


P.S. I've included the following code for reference.

The following code is in the AfterRowColChange event of the grid.
* Evaluate the DynamicRowEnabled expression and store the value.
* ----------------------------------------------------------------------
logRowEnabled = EVALUATE(This.DynamicRowEnabledExpression)
		
* If the DynamicRowEnabled evaluated to a logical value, then use that
* value to set the .Enabled property of the columns in the grid.  If it
* did not evaluate to a logical value, then something is wrong.  Disable
* all columns in the grid.
* ----------------------------------------------------------------------
IF VARTYPE(logRowEnabled) == "L" THEN
	&& Great.  Use the variable as-is.
ELSE
	logRowEnabled = .F.
ENDIF		
This.RowEnabled(logRowEnabled)


The RowEnabled method is a custom method containing the following code (comments and error handling omitted for simplicity):
LPARAMETERS logEnabledSetting

This.SetAll("Enabled", logEnabledSetting, "Column")
John Groft
Consultant
Computer Task Group, Inc.
Next
Reply
Map
View

Click here to load this message in the networking platform