Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Hot keys for buttons
Message
From
07/06/2002 04:20:35
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00665597
Message ID:
00665811
Views:
21
Hi!

I also go for option to use Cancel=.T. for button. It does not matter that field value changes are lost when user press ESC key - you will cancel anyway, and in most interfaces pressing cancel does not prompt user for confirmation. So, wonder why this is an issue?

BTW, This is also a common problem (like it was with value of field not saved when saving data from toolbar or hotkey that we discussed in recent thread). And, as usual, many frameworks has workarounds for this.

In our framework we created special generic approach for this, but we did not dived so deep into generalizing things. We have a propery to specify Cancel button object location (starting from thisform object). Then we just had a generic method in the form class that using coordinates of mouse and coordinates of button determine if that button is pressed by mouse. Also, check for all other things like ESC or hotkey or whatever. Remember that Cancel button could go with image, as well as a hot key for it could be not always "C".


>Hi everybody,
>
>How can I find out, if button has a Hot Key (letter highlighted) and what's the value of it. Say, I have Cancel button with first letter highlighted. I added in my CancelValidation method of the form:
>
>
>********************************************************************
>*  Description.......: CancelValidation
>*  Calling Samples...:
>*  Parameter List....:
>*  Created by........: John Koziol
>*  Modified by.......:
>********************************************************************
>local nCancelTop,nCancelHeight,nCancelLeft,nCancelWidth, llReturn
>nCancelTop=thisform.cmdCancel.top
>nCancelBottom=m.nCancelTop+thisform.cmdCancel.height
>nCancelLeft=thisform.cmdCancel.left
>nCancelRight=m.nCancelLeft+thisform.cmdCancel.width
>llReturn = .f.
>if between(mrow(thisform.name,3),m.nCancelTop,m.nCancelBottom) and ;
>		between(mcol(thisform.name,3),m.nCancelLeft,m.nCancelRight) and ;
>		mdown()
>	llReturn = .t.
>endif
>return m.llReturn or lastkey()= 46 && Alt+C (shortcut for Cancel)
>
>Is there a way to make this more generic (e.g. find out key combination for Cancel button automatically)?
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.com
ICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs

It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform