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 » ControlBars in a dialog Collapse All
Subject Author Date
Suhai Gyorgy Oct 9, 2005 - 12:00 PM

Hi! I have a MainFrame as the main window of my application and want to modally open another window that have a menubar, a toolbar, a statusbar and a simple controlbar. I could do the menubar and the toolbar as you did in ProfUIS-Controls, but couldn’t make the rest work.
May I ask for a small sample that shows how to put all the controlbars mentioned above on a dialog (probably a CExtResizableDialog) that is not my applications main window? Thank you very much: Chris

Technical Support Oct 9, 2005 - 12:44 PM

There is one important limitation to using the CExtMenuControlBar class: there must be only the one menu bar instance in a scope of one command profile in the command manager. This means your modal window must be based on a separately allocated command profile with its unique name. In case of the modal dialog window, please try this:

1) Allocate a new command profile for this dialog window by calling g_CmdManager->ProfileSetup( _T("UniqueProfileName"), m_hWnd ) from the OnInitDialiog() virtual method of your dialog window class.

2) Remove this profile by invoking the g_CmdManager->ProfileDestroy( _T("UniqueProfileName"), true ) from the OnOK() and OnCancel() methods of your dialog window class.

We think these two small code improvements will fix the issue. If not, then please let us know so we can create a small sample application for you.

Wilhelm Falkner Oct 18, 2005 - 2:24 AM

Using a second command profile works fine, but CExtCustomizeSite::CustomizeStateLoad and CExtCustomizeSite::CustomizeStateSave do not work; toolbars are destroyed. What do I wrong ??
TIA Willi

Technical Support Oct 18, 2005 - 10:16 AM

Previously we discussed a dialog-based application in this thread. But the customize site is (and should be) used with frame-based applications. So, we need more details about your application. Please describe the entire layout of your application and when/where the problem occurs.

Wilhelm Falkner Oct 18, 2005 - 10:41 AM

You are right, this topic is about dialog based applications, but I think, the problem is the same in MDI applications. Some months ago, I have had a problem in a MDI application with a framewindow with own toolbars and menues. You solved the problem (I send you the source code), but you also needed to create an new version to solve the problem. The trick was to create an own profile. All seems to work ok. Some days ago i saw, that the state of menu, toolbars in this frame window was not (re-)stored. I thought, CExtCustomizeSite::CustomizeStateSave in this framewindow during DestroyWindow should solve this, so I inserted these lines. But after this calls, the toolsbars do not have any functions more at the next open of this framewindow. To get them working, I have to delete saved state in the windowsregistry.
TIA Willi

Technical Support Oct 19, 2005 - 2:48 AM

If the problem persists, you can send us your source code so we can help you.

Suhai Gyorgy Oct 10, 2005 - 2:31 AM

Well, I’m having problems with putting the statusbar and especially the CExtControlBar on my dialog... And those problems are not solved by the code improvements mentioned above. Even though, thank you for this info about setting up a different profile, I’m sure it solved some problems that didn’t even come up yet:)


I would still like to ask for that small sample about putting statusbar and controlbar on my dialog. Thank you again: Chris

Technical Support Oct 10, 2005 - 8:07 AM

To use the status bar in the dialog window is extremely simple. Please take a look at this project.

We just generated a simple dialog-based application, added CTestDlg::m_wndStatusBar property and created it in the CTestDlg::OnInitDialog() method. To stick the status bar to the bottom of the dialog window, we invoke the CWnd::RepositionBars() method in the OnInitDialog() and OnSize() methods. You can replace the CDialog class with CExtResizableDialog and the CStatusBar class with CExtStatusControlBar. The result will be the same. Of course, after creating the status bar in your dialog, you need to initialize its panes.


As for the CExtControlBar class, it cannot be used in dialogs. You can only use the classes derived from it: CExtToolControlBar and CExtMenuControlBar.

Suhai Gyorgy Oct 10, 2005 - 9:11 AM

Thank you, it works now. What caused the problem was that I put a custom-control where the statusbar was meant to be, just as I had to do with the toolbar and menubar.


Another thing though: I got a resizing-triangle in the bottom-right corner of my statusbar... How can I remove that? Anyway, how did it get there? I don’t have anything like that in the other statusbar in my MainFrame window. Does it have anything to do with the CBRS_GRIPPER style? Thank you again: Chris.

Technical Support Oct 10, 2005 - 9:43 AM

Simply override the CExtStatusControlBar::OnQueryGripperEnabledState() virtual method and return false in it:

virtual bool OnQueryGripperEnabledState() const
{
    ASSERT_VALID( this );
    return false;
}


Suhai Gyorgy Oct 11, 2005 - 3:38 AM

I’ve done as you suggested... Now I can’t see the resizing-triangle in the corner, but I can still resize my statusbar as if it was still there! How could I completely disable resizing the statusbar but enable resizing my dialog? Thank you: Chris.

Technical Support Oct 11, 2005 - 8:36 AM

Please use a CExtStatusControlBar-derived class (or CStatusBar-derived) and implement the WM_NCHITTEST standard Windows message handler in it like as follows:

// declaration
afx_msg UINT OnNcHitTest(CPoint point);

// message map entry
ON_WM_NCHITTEST()

// implementation
UINT CYourStatusBar::OnNcHitTest(CPoint point) 
{
UINT nHitTest = CExtStatusControlBar::OnNcHitTest(CPoint point);
    if( nHT == HTBOTTOMLEFT || nHT == HTBOTTOMRIGHT )
        nHT = HTCLIENT;
    return nHitTest;
}

Suhai Gyorgy Oct 11, 2005 - 9:10 AM

Well, there were some mistakes in your code, but I could figure it out:)) Now I can’t resize my StatusBar (which is good) but I can’t resize my CExtResizableDialog either, although I would need that:(   Any further ideas?;)

Technical Support Oct 11, 2005 - 9:41 AM

Please make sure that you turned on the Resizing style in the Border combo box.

Suhai Gyorgy Oct 12, 2005 - 1:57 AM

That was kind of novice mistake of me, sorry:) Chris