>I have only 2 colunms available for the user to enter data on a 5 colunms grid. I would like the read-only fields to be jump automatically. Do we need to code this or is there a property for that?
Eric,
As others have told you, the way to prevent a user from moving to a column is to return .F. from the When() of the control in the column.
This is on example where you do not want the user to have access to a control.
The best way to implement access control is in the abstract classes of you control set. Add a property called something like
CanGetFocus. Its default value would be .T.
In the when() event of your control class add the following code:
WITH this
(your other When() code)
IF !(.CanGetFocus)
RETURN .F.
ENDIF
ENDWITH
RETURN .T.
Now you are all set to control user access to any control just by setting the CanGetFocus property appropriately. It may also be set dynamically in your code to permit/deny access depending on the logic of your form or application.
You may also control the colors in which the control is displayed rather than having to manipulate the Visual FoxPro default color scheme.
One effective way of displaying a denied control is by using dark gray rather than black as the foreground color. I have implemented 4 color schemes by setting a property called CannotGetFocusColorPalette (I'm sure you will think of a much better name for the property) which takes 1 = normal colors, 2 = special access denied colors, 3 = readonly colors and 4 = disabled colors.
If you are working in VFP6, you can set these colors dynamically whenever CanGetFocus changes using your assign method.
regards,
Jim Edgar
Jurix Data Corporation
jmedgar@yahoo.comNo trees were destroyed in sending this message. However, a large number of electrons were diverted from their ordinary activities and terribly inconvenienced.