CCmdUI for control bar in CMDIChildFrame
Yoong Hor Meng -- eng30391@leonis.nus.sg Tuesday, January 28, 1997 Environment: VC++ 1.52, Windows 3.11 Hi: I have use the example in mfc/samples/ctrlbar to implement a CPaletteBar, which is just a floating CControlBar. The different is that the owner is CMDIChildFrame instead of CMainFrame. I guess it should have no problem. No the problem is that when user click a button on palette bar, the button does not sink after the click is released, ie remain normal. Somebdy has mentioned before that in order to check to the button that the user has click, I need to implemet another object such as combobox to synchrnize the state of the palette. I have tried it too, it does not work. any idea? Thank you.
Yuriy Briklin -- ybriklin@juno.com Wednesday, January 29, 1997 Hi Yoong. In order to check a button or menu item you should create handler for UPDATE_COMMAND_UI (you can use Class Wizard) for this button or menu item. You can create this handler in any class that is in automatic routing chain otherwise you should rout UPDATE_COMMAND_UI message yourself. Pay attention to file mainfrm.cpp from mfc/samples/ctrlbar project. In the message map of CMainFrame you can see lines: ON_UPDATE_COMMAND_UI(ID_PALETTEERASE, OnUpdatePalette) ON_UPDATE_COMMAND_UI(ID_PALETTEPEN, OnUpdatePalette) ... ... and at the end of the file you can find function OnUpdatePalette(). This function does the job. Yes, combo box is used in OnUpdatePalette(), but you can store user's selection in any class member of in any static variable. In the example combo box is used just to give a user the way to make a selection without palette (you can hide it using menu). I hope this will help you. Yuriy Briklin On Tue, 28 Jan 1997 11:26:36 +0800 (SST) Yoong Hor Mengwrites: > Environment: VC++ 1.52, Windows 3.11 > > Hi: > I have use the example in mfc/samples/ctrlbar to implement a > CPaletteBar, which is just a floating CControlBar. The different is > that > the owner is CMDIChildFrame instead of CMainFrame. I guess it should > have > no problem. No the problem is that when user click a button on > palette > bar, the button does not sink after the click is released, ie remain > normal. Somebdy has mentioned before that in order to check to the > button > that the user has click, I need to implemet another object such as > combobox to synchrnize the state of the palette. I have tried it > too, it > does not work. any idea? Thank you. > > >
| Вернуться в корень Архива |