|
From: <jos...@ya...> - 2001-01-05 13:49:17
|
--- Ramana Kumar <ra...@my...> escribió: > How do I make a
PUSHBUTTON respond to a key?
> For example, when you click File->Open in Dev-C++ you have a window
> to open
> the file. If you press escape, the "Cancel" button is pressed and if
> you
> press enter, the "Open" button is pressed.
>
> How can I make a button I create respond to a key like this?
> I make the button in the resources file in a dialog box:
>
> ...
> PUSHBUTTON "Cancel",-1,0,0,100,15
> ...
>
> When I make an item on a menu respond to a key, it is like this:
>
> Myaccel ACCELERATORS
> {
> <key>,<ID>,VIRTKEY
> }
>
> Is there a similar thing for buttons?
>
> Please note from my source code that I am using the Win32 API, but,
> if you
> know of a way I can solve the problem that is different from this
> (and, of
> course, works in Dev-C++) I would be happy to hear about it.
>
> Thank you,
> Xerchzkopfinc. Ramana Kumar (Ra...@my...)
> ICQ# 93667117
> To get paid for surfing the 'net please visit
> https://www.alladvantage.com/joinsecure.asp?refid=jpn471&cntry=1
>
That deppends on the key, but to make it simple use this
PUSHBUTTON "C&ancel",-1,0,0,100,15
and when you press the key a the button will be pushed.
Cheers,
Chemanuel
__________________________________________________
Do You Yahoo!?
Yahoo! Photos - Share your holiday photos online!
http://photos.yahoo.com/
|
|
From: <jos...@ya...> - 2001-01-08 13:55:01
|
Ramana, >I realised that I could use the & to "accelerate" a key (I use this >with my menu items, &Open, for example). I appologise. >Do you know the way I can make my "&Cancel" button respond to the "Esc" >key? >Are there special ways for each key (like DEFPUSHBUTTON, for "Enter")? I think that is not possible. Check what the Win32 API says: ======================================================== Windows provides a special keyboard interface for dialog boxes that carries out special processing for several keys. The interface generates messages that correspond to certain buttons in the dialog box or changes the input focus from one control to another. Following are the keys used in this interface and their respective actions. Key Action ALT+mnemonic Moves the input focus to the first control (having the WS_TABSTOP style) after the static control containing the given mnemonic. DOWN Moves the input focus to the next control in the group. ENTER Sends a WM_COMMAND message to the dialog box procedure. The wParam parameter is set to IDOK or control identifier of the default push button. ESC Sends a WM_COMMAND message to the dialog box procedure. The wParam parameter is set to IDCANCEL. LEFT Moves the input focus to the previous control in the group. mnemonic Moves the input focus to the first control (having the WS_TABSTOP style) after the static control containing the given mnemonic. RIGHT Moves the input focus to the next control in the group. SHIFT+TAB Moves the input focus to the previous control that has the WS_TABSTOP style. TAB Moves the input focus to the next control that has the WS_TABSTOP style. UP Moves the input focus to the previous control in the group. The Win32 API automatically provides the keyboard interface for all modal dialog boxes. It does not provide the interface for modeless dialog boxes unless the application calls the IsDialogMessage function to filter messages in its main message loop. This means that the application must pass the message to IsDialogMessage immediately after retrieving the message from the message queue. The function processes the messages if it is for the dialog box and returns a nonzero value to indicate that the message has been processed and must not be passed to the TranslateMessage or DispatchMessage function. Because the dialog box keyboard interface uses direction keys to move between controls in a dialog box, an application cannot use these keys to scroll the contents of any modal dialog box or any modeless dialog box for which IsDialogMessage is called. When a dialog box has scroll bars, the application must provide an alternate keyboard interface for the scroll bars. Note that the mouse interface for scrolling is available when the system includes a mouse. ================================================================================== >I also noticed that you and a few other win32 programmers have been >talking about MSDN. I have got a version of the SDK help (win32.hlp) but this >is very old (based on the content) - it doesn't cover HTML help, only Win >Help and a few other things are old too. I'll have a look at the MSDN site, >but could you tell me the URL to download the SDK help or, the hyperlinks >to take. Don´t remember exactly but here is a start http://msdn.microsoft.com/ and check for Platform SDK Latest version of win32.hlp is given out by Borland. The file name is b5ms.zip (17 Mb). I´ll update soon my pages to the server. There should be the links http://www.geocities.com/josempadron/ >Also, do you know whether I am using MFC or pure API? I don't use >functions like OnInitDlg(), for dialogs I use a BOOL CALLBACK function. Oh, and >what does SDK stand for, because although this came from Microsoft, it seems >to cover some of the things I use (which I thought was pure API). I could >be using both. I don´t use, know, ... MFC. Hope this helps. Don´t hesitate to ask more. Cheers, Chemanuel __________________________________________________ Do You Yahoo!? Yahoo! Photos - Share your holiday photos online! http://photos.yahoo.com/ |
|
From: James G. <Jam...@Cl...> - 2001-01-08 14:34:41
|
If you give the button an ID of IDCANCEL it will be handled by Windows. basically Windows defined IDOK and IDCANCEL and when enter and escape = are pressed knows exactly what to do. See http://msdn.microsoft.com/library/psdk/tools/dlgedit_4pdf.htm for = more info. Regards, James. -----Original Message----- From: Jose Manuel Padron Carrillo [mailto:jos...@ya...] Sent: Monday, January 08, 2001 1:55 PM To: dev...@li... Subject: RE: [Dev-C++] buttons Ramana, >I realised that I could use the & to "accelerate" a key (I use this=20 >with my menu items, &Open, for example). I appologise. >Do you know the way I can make my "&Cancel" button respond to the "Esc"=20 >key? >Are there special ways for each key (like DEFPUSHBUTTON, for "Enter")? I think that is not possible. Check what the Win32 API says: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D Windows provides a special keyboard interface for dialog boxes that carries out special processing for several keys. The interface generates messages that correspond to certain buttons in the dialog box or changes the input focus from one control to another. Following are the keys used in this interface and their respective actions.=20 Key Action ALT+mnemonic Moves the input focus to the first control (having the WS_TABSTOP style) after the static control containing the given mnemonic. DOWN Moves the input focus to the next control in the group. ENTER Sends a WM_COMMAND message to the dialog box procedure. The wParam parameter is set to IDOK or control identifier of the default push button. ESC Sends a WM_COMMAND message to the dialog box procedure. The wParam parameter is set to IDCANCEL. LEFT Moves the input focus to the previous control in the group. mnemonic Moves the input focus to the first control (having the WS_TABSTOP style) after the static control containing the given mnemonic. RIGHT Moves the input focus to the next control in the group. SHIFT+TAB Moves the input focus to the previous control that has the WS_TABSTOP style. TAB Moves the input focus to the next control that has the WS_TABSTOP style. UP Moves the input focus to the previous control in the group. =20 The Win32 API automatically provides the keyboard interface for all modal dialog boxes. It does not provide the interface for modeless dialog boxes unless the application calls the IsDialogMessage function to filter messages in its main message loop. This means that the application must pass the message to IsDialogMessage immediately after retrieving the message from the message queue. The function processes the messages if it is for the dialog box and returns a nonzero value to indicate that the message has been processed and must not be passed to the TranslateMessage or DispatchMessage function.=20 Because the dialog box keyboard interface uses direction keys to move between controls in a dialog box, an application cannot use these keys to scroll the contents of any modal dialog box or any modeless dialog box for which IsDialogMessage is called. When a dialog box has scroll bars, the application must provide an alternate keyboard interface for the scroll bars. Note that the mouse interface for scrolling is available when the system includes a mouse. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D =3D=3D=3D=3D=3D=3D >I also noticed that you and a few other win32 programmers have been=20 >talking about MSDN. I have got a version of the SDK help (win32.hlp) but this=20 >is very old (based on the content) - it doesn't cover HTML help, only Win=20 >Help and a few other things are old too. I'll have a look at the MSDN site,=20 >but could you tell me the URL to download the SDK help or, the hyperlinks=20 >to take. Don=B4t remember exactly but here is a start http://msdn.microsoft.com/ and check for Platform SDK Latest version of win32.hlp is given out by Borland. The file name is b5ms.zip (17 Mb). I=B4ll update soon my pages to the server. There should be the links http://www.geocities.com/josempadron/ >Also, do you know whether I am using MFC or pure API? I don't use=20 >functions like OnInitDlg(), for dialogs I use a BOOL CALLBACK function. Oh, and=20 >what does SDK stand for, because although this came from Microsoft, it seems=20 >to cover some of the things I use (which I thought was pure API). I could=20 >be using both. I don=B4t use, know, ... MFC. Hope this helps. Don=B4t hesitate to ask more. Cheers, Chemanuel __________________________________________________ Do You Yahoo!? Yahoo! Photos - Share your holiday photos online! http://photos.yahoo.com/ _______________________________________________ Dev-cpp-users mailing list Dev...@li... http://lists.sourceforge.net/mailman/listinfo/dev-cpp-users * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *=20 This electronic message and any attachment is intended to be=20 read by the named addressee(s) only.=20 Any other recipient should be aware that its contents may be=20 legally privileged and/or confidential and that its use,=20 disclosure, copying or distribution may be unlawful.=20 Unless you are a named addressee, please delete this message=20 Whilst C. & J. Clark International Limited has taken steps=20 to prevent the transmission of computer viruses with electronic mail,=20 responsibility for screening incoming messages and the risk of such=20 transmission and its consequences lies with the recipient.=20 C. & J. Clark International Limited=20 Registered in England and Wales=20 Company No. 141015=20 Registered Office: 40 High Street, Street, Somerset BA16 0YA=20 Telephone: +44 (0) 1458 443131=20 Fax: +44 (0) 1458 447547=20 |
|
From: Ramana K. <ra...@my...> - 2001-01-05 23:45:08
|
Jose, I realised that I could use the & to "accelerate" a key (I use this with my menu items, &Open, for example). >That depends on the key... Do you know the way I can make my "&Cancel" button respond to the "Esc" key? Are there special ways for each key (like DEFPUSHBUTTON, for "Enter")? I also noticed that you and a few other win32 programmers have been talking about MSDN. I have got a version of the SDK help (win32.hlp) but this is very old (based on the content) - it doesn't cover HTML help, only Win Help and a few other things are old too. I'll have a look at the MSDN site, but could you tell me the URL to download the SDK help or, the hyperlinks to take. Also, do you know whether I am using MFC or pure API? I don't use functions like OnInitDlg(), for dialogs I use a BOOL CALLBACK function. Oh, and what does SDK stand for, because although this came from Microsoft, it seems to cover some of the things I use (which I thought was pure API). I could be using both. Thank you so much, Ramana Kumar ICQ# 93667117 Get paid to surf the web! Go to: https://www.alladvantage.com/joinsecure.asp?refid=jpn471&cntry=1 -----Original Message----- From: dev...@li... [mailto:dev...@li...]On Behalf Of Jose Manuel Padron Carrillo Sent: Saturday, January 06, 2001 12:49 AM To: dev...@li... Subject: Re: [Dev-C++] buttons --- Ramana Kumar <ra...@my...> escribió: > How do I make a PUSHBUTTON respond to a key? > For example, when you click File->Open in Dev-C++ you have a window > to open > the file. If you press escape, the "Cancel" button is pressed and if > you > press enter, the "Open" button is pressed. > > How can I make a button I create respond to a key like this? > I make the button in the resources file in a dialog box: > > ... > PUSHBUTTON "Cancel",-1,0,0,100,15 > ... > > When I make an item on a menu respond to a key, it is like this: > > Myaccel ACCELERATORS > { > <key>,<ID>,VIRTKEY > } > > Is there a similar thing for buttons? > > Please note from my source code that I am using the Win32 API, but, > if you > know of a way I can solve the problem that is different from this > (and, of > course, works in Dev-C++) I would be happy to hear about it. > > Thank you, > Xerchzkopfinc. Ramana Kumar (Ra...@my...) > ICQ# 93667117 > To get paid for surfing the 'net please visit > https://www.alladvantage.com/joinsecure.asp?refid=jpn471&cntry=1 > That deppends on the key, but to make it simple use this PUSHBUTTON "C&ancel",-1,0,0,100,15 and when you press the key a the button will be pushed. Cheers, Chemanuel __________________________________________________ Do You Yahoo!? Yahoo! Photos - Share your holiday photos online! http://photos.yahoo.com/ _______________________________________________ Dev-cpp-users mailing list Dev...@li... http://lists.sourceforge.net/mailman/listinfo/dev-cpp-users |