Professional UI Solutions
Site Map   /  Register


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
Celal Sen Jul 5, 2011 - 11:18 AM

Hi Support Team,

We have a dialog class inherited from CDialog.

class CMyDialog : public CDialog

And we have lots of dialogs (100 maybe) inherited from CMyDialog.

class CMyDialog1  :  public CMyDialog

class CMyDialog2  :  public CMyDialog

class CMyDialog3  :  public CMyDialog


We used to create a toolbar in base CMyDialog class and use it in other inherited dialog classes.

I searched the examples and the forum and saw that, if I want to put a toolbar(CExtToolControlBar) in a dialog, I have to put the toolbar control in dialog resource and write the appropriate code in DoDataExchange() method.

It is impossible for me to put a CExtToolControlBar control in every dialog resource seperately. Could you suggest me an alternative way to create toolbar in dialog which will solve my problem? Thanks.

Celal Sen Jul 12, 2011 - 3:23 AM

Thank you for the sample project. Problem solved. I think the key point here is this part.

m_wndToolBar.m_bPresubclassDialogMode = true;

Celal Sen Jul 11, 2011 - 8:52 AM

BTW my base CDialog class is drived from CExtResizableDialog class.

Celal Sen Jul 11, 2011 - 8:02 AM

I’ve already tried to create the CExtControlBar control inside the code but it crashed becuse CExtControlBar::DoCustomModePreTranslateMessage calls CExtControlBar::PreTranslateMessage endlessly ending in a infinite loop. Could you post a sample working project?

Technical Support Jul 11, 2011 - 12:48 PM
Technical Support Jul 8, 2011 - 12:26 PM

You can avoid modifying all dialog templates. Just create a toolbar from code using CExtControlBar::Create() API and then load the toolbar using the CExtToolControlBar::LoafToolbar() API.

Celal Sen Jul 7, 2011 - 5:01 PM

But I have maybe a hundred dialog classes inherited from CMyDialog and all of them have their own dialog template resources. Do you mean that I have to add CExtToolControlBar control in all of my dialogs? Is there an easy way to do this? Thanks.

Technical Support Jul 7, 2011 - 12:22 PM

You should use a custom control on your dialog template resource. Please take a look at the IDD_PROFUIS_CONTROLS_DIALOG dialog in the ProfUIS_Controls sample application. It contains two custom controls at top. One is for CExtMenuControlBar and another one for CExtToolControlBar You should create the same on your dialog, add a CExtToolControlBar property into your CMyDialog class, manually add an DDX_Control entry for it, load the toolbar using CExtToolControlBar::LoadToolBar() API in CMyDialog::OnInitDialog() method and, invoke CWnd::RepositionBars(0,0xFFFF,0); both in the CMyDialog::OnInitDialog() and CMyDialog::OnSize() methods to let the toolbar dock itself to a dialog side.