Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Checkbox - Click vs Keypress
Message
From
31/08/2010 12:31:06
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01479450
Message ID:
01479453
Views:
67
Contrary to popular belief, there are three states that a checkbox can have:

- Checked
- Unchecked
- Undertermined

When you click, you only get the first two states. When you use the spacebar, you can get all three.

You can fix with with code in the KeyPress event:
IF (nKeyCode = 32)
    This.Value = !This.Value
    ThisForm.Refresh()
ENDIF
The code to enable/disable other controls should be moved to the Form.Refresh method.
This.txtlimitedby.Enabled = This.Chkbox.Value
This.limiteddays.Enabled = This.Chkbox.Value
>Hi Gang!
>
>Question here.....
>
>We have a form that is used for configuring the POS system we support.
>
>We have lots of checkboxes on this form.
>
>We added a textbox and a label beside one of the checkboxes.
>
>When you click this checkbox, it enables and disables them according to the click you just did....
>
>checkbox.click
>
>IF this.Value
>	this.parent.txtlimitedby.ENABLED =.T.
>	this.Parent.limiteddays.ENABLED = .T.
>ELSE
>	this.parent.txtlimitedby.ENABLED =.F.
>	this.Parent.limiteddays.ENABLED = .F.
>ENDIF
>THISFORM.REFRESH
>
>
>This works great with the textbox and the label.....
>
>But when you press the spacebar, when the checkbox has a checkmark, the checkbox does not change, but the textbox and the label but disable and will not reenable.
>
>And if you press the spacebar, when the checkbox does not have a checkmar, the checkbox does not change, but the textbox and the lablel then enable and will not disable.
>
>Ok... what am I obviously overlooking?
>
>Thanks!
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform