Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

A semi-disabled control

Status
Not open for further replies.

Kimed

Programmer
May 25, 2005
104
LT
Hi,

I'd like to have a check box in my data input screen that could not be entered other than by clicking the mouse on it. That is, when the user fills other fields or presses TAB/Shift-TAB/ENTER to navigate fields it wouldn't get focus, as the rest of the form is keyboard-entered and this box shouldn't be flipped by accident nor demand an extra keystroke to leave it, only reacting in rare cases when the user makes a point to select it. I thought about checking for LASTKEY() in its WHEN routine, but LASTKEY() doesn't recognize mouse clicks like INKEY() does.

Though I have a backup solution - make the checkbox disabled and flip its value by ON KEY LABEL shortcut instead of the mouse, but using mouse for it looks more "elegant" to me. Is it possible?
 
The problem with using LASTKEY(), is it reatins the last keypress no matter where it was. So even if the cursor is in a different field and you click the mouse, LASTKEY() could return an Enter or Tab or whatever.

You may be able to do something like write a function/procedure using something like, ON KEY LABEL LEFTMOUSE DO SomeFunc().
Check for X-Y coordinates and if they fall within the predefined area of the checkbox, toggle the value.


-Dave Summers-
[cheers]
Even more Fox stuff at:
 

I have only VFP6 around, so can't check if this information is relevant to the older versions, but in VFP you have to set the control's TabStop property to False. This way, you will make sure that the Tab won't stop there, but a mouse click will set focus to it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top