![]() |
Modifying ToolBar During Runtime |
Post Reply ![]() |
Author | |
nguyena1 ![]() Groupie ![]() Joined: 28 November 2005 Status: Offline Points: 16 |
![]() ![]() ![]() ![]() ![]() Posted: 08 May 2006 at 3:00pm |
What I'm trying to do is have a combo box on the tool bar that I can some what destroy and create during runtime in order to switch styles between CBS_DROPDOWN and CBS_DROPDOWNLIST. Problem is: After its changed, i have to make a mousemove inorder for the combo box to actually come up instead of a grey area. What I have inside of CMainFrame::OnCreateControl(LPCREATECONTROLSTRUCT lpCreateControl) for this works great on start up. FYI: I make a CXTPControlCustom and do lpCreateControl->pControl = pControlEntry. I save a pointer to this CXTPControlCustom in my custom combo class.(call it m_pControlEntry) Here is the code for how I change the combo box. for example from dropdown to dropdown list //////////////////////////////////////////////////////////// ///////////////////////// ModifyStyle(CBS_DROPDOWN, CBS_DROPDOWNLIST | WS_VSCROLL); CComboBox comboNew; comboNew.ShowWindow(SW_HIDE); SetOwner(AfxGetMainWnd()); comboNew.SetFont(pFont); if (m_pControlEntry) //////////////////////////////////////////////////////////// //////////////// So afterwards, theres a grey area until a little after i move my mouse, is there some kind of update i can call? m_ComboBox for example is the name of the combobox. I've tried m_ComboBox.RedrawWindow(), Invalidate(), Redraw(), SetVisible, and none of those will do it. Tony |
|
![]() |
|
nguyena1 ![]() Groupie ![]() Joined: 28 November 2005 Status: Offline Points: 16 |
![]() ![]() ![]() ![]() ![]() |
Here is a sample project i've done this to. For Codejock version 10.1. Open up ..samples\commandbars\commoncontrols and please replace the mainfrm.cpp, mainfrm.h, and resource.h files and in the res folder, replace OptionsBar.bmp with the 4 files attached here. What I've done is added a combo box to the options tool bar. When you click on Hide Vertically, I recreate the combo box to a dropdownlist(see line 633 of mainfrm.cpp). When you click on Show vertically(see line 683 of mainfrm.cpp), I recreate the combo box to a dropdown style. Whats even funnier with this is that, when it does get recreated, the combo box doesnt show any more. If you maximize or minimize, the combo box will show up with the right attributes. What is the key call that makes this combo box show up? |
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |