Subj : Re: beginning dialog boxes (3) To : borland.public.cpp.borlandcpp From : "Ed Mulroy [TeamB]" Date : Sun Sep 21 2003 04:05 pm I have never used an accelerator table in a dialog box, only in a normal window with a menu. I avoid accelerator tables, thinking of them as a cumbersome item which puts code-like behavior in the resource file instead of in the source file where it belongs. I just handle such things in the window procedure when the key I want to be an accelerator is pressed, but again, that is in a normal window, not in a dialog. I invite you to spend some time looking through the help file, win32.hlp, in the index where items starting with the words accellerator or accelerators are found or in one of Petzold's "Programming Windows *" books. I also do not think the F5 key is intuitive. Good interface design is intuitive, the user can assume something associates with the act it performs. If I wanted accelerator like keys for the dialog I would instead change the RC file to this: ------------------------- #include "demo.rh" DIALOG_1 DIALOG 6, 15, 194, 119 STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION CAPTION "Dialog Box Caption" FONT 8, "MS Sans Serif" { DEFPUSHBUTTON "&OK", IDOK, 27, 94, 50, 14 PUSHBUTTON "&Cancel", IDCANCEL, 110, 94, 50, 14 PUSHBUTTON "&Push Me", IDC_PUSHBUTTON1, 72, 48, 50, 14 EDITTEXT IDC_EDIT1, 42, 20, 126, 12 } ------------------------- Where the only changes are to add an ampersand as the first letter in the button names. Those letters will then be shown underlined and Alt-O, Alt-C and Alt-P will push the corresponding buttons. I think it is imperative that you get and read a book on how Windows works and how to program for it. Without that you will only be able to flounder around. .. Ed > hedgehog wrote in message > news:3F6DD33B.30108@hcn.ru... > Hi > I want that did too that "Push Me" > I add... > //-- in DEMO.RC -- > ACCEL_1 ACCELERATORS > { > VK_F5, IDC_PUSHBUTTON1, VIRTKEY > } > //-- in DEMO.RH -- > #define ACCEL_1 2 > > What I should add in DEMO.CPP for enabling an accelerator? > > PS. Sorry my poor English :-( .