Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!lll-winken!uunet!zaphod.mps.ohio-state.edu!usc!snorkelwacker.mit.edu!bloom-beacon!eru!hagbard!sunic!news.funet.fi!funic!fuug!tuura!risto From: risto@tuura.UUCP (Risto Lankinen) Newsgroups: comp.windows.ms.programmer Subject: ChangeAccelerator(), is there? Message-ID: <993@tuura.UUCP> Date: 6 Feb 91 14:17:16 GMT Distribution: comp Organization: Nokia Data Systems Oy Lines: 52 Hi! I'm making a Windows program with a few controls (mainly buttons), which are children of a child window of the main window. I'll show ya: hWndMain --(child)--> hWndChild --(children)-+-> hWndButton[1] +-> hWndButton[2] | . . . +-> hWndButton[N] The child window is 'ribbon', in terminology used by Word for Windows. I cannot (=wouldn't like to) create the buttons directly from the main window, because I'm planning to make the ribbon control a stand-alone class in a custom DLL, which would have its own resizing logic, etc. The buttons are changed dynamically at run-time, and they most have an accelerator (as in "Do &This" being triggered with the Alt+'T'), which is defined with WM_SETTEXT, and makes the underlined character be shown accordingly. By pressing the buttons with the mouse, there's no problem in receiving WM_COMMAND messages at the hWndChild's window procedure, nor forwarding them to the main window procedure. Unfortunately I haven't found a way to use their 'accelerators' from the keyboard. I've managed to make a more or less working handler for the WM_MENUCHAR message in order to trap the Alt+ events and act depending on the state of the buttons. I think there's also a way to do what I'm aiming, by fiddling with child window activation & focus setting functions, but they're kinda scary... What I'd like to do, is to tell the accelerator table to modify itself at run-time and reflect the changes I'm making to the configuration of the buttons. This is much like the Windows already does, when an application changes its menu. ( Maybe there's an undocumented call...) If impossible, I'd be glad of any ideas on how to do it in an other way, using which I could avoid the struggle I'm having with the WM_MENUCHAR message handling. Terveisin: Risto Lankinen P.S. I've tried R:ing TFM, really. The Guide to Programming is verbose on the different ways you can make use of a particular control, but even the sample program utilizes one control only, making itself essentially unusable as an example for one who wishes to learn how to make a number of them interact. -- Risto Lankinen / product specialist *************************************** Nokia Data Systems, Technology Dept * 2 2 * THIS SPACE INTENTIONALLY LEFT BLANK * 2 -1 is PRIME! Now working on 2 +1 * replies: risto@yj.data.nokia.fi ***************************************