Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » Toolbar in Dialog Collapse All
Subject Author Date
Paul Cowan Aug 20, 2007 - 8:56 AM

Are there any example of how to add a toolbar to a dialog? I’ve tried, but I only get one button in the middle of the toolbar.

Paul Cowan Aug 20, 2007 - 2:24 PM

OK, thanks. I have the toolbar in the dialog now. Now I have a problem where the ON_UPDATE_COMMAND_UI messages are not beeing called until a button is clicked. After setting false for pCmdUI->Enable, the button can never reenabled.

Technical Support Aug 21, 2007 - 6:49 AM

The command updating mechanism for toolbars and menus used in the dialog window should work exactly like in the frame window and typically you should not do anything special for that. Toolbar buttons are updated by the toolbar’s owner window. By default, the toolbar’s owner window is its parent dialog or frame window. The toolbar’s owner window is detected automatically, but in some cases like non-modal dialogs, you may need to specify the toolbar’s owner window explicitly by invoking its CWnd::SetOwner() method. Please let us know more details about the dialog window in your project or send us a test project so we can help you find out what is wrong.

Technical Support Aug 20, 2007 - 12:17 PM

You can find toolbars inserted as custom dialog controls in the ProfUIS_Controls sample. Just drop a custom control onto the dialog form and copy its properties from a similar control in ProfUIS_Controls. Then add the CExtToolControlBar property to the dialog class, add DDX entry for it in dialog’s DoDataExchange() method, load the toolbar in the OnInitDialog() method and invoke CWnd::RepositionBars(0,0xFFFF,0) code both in dialog’s OnInitDialog() and OnSize() methods to let the toolbar stick to the dialog’s border.