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 » How to add maximize button in floating control bar? Collapse All
Subject Author Date
Chun Pong Lau Dec 11, 2009 - 8:55 AM

Dear sir/madam,


How to add a maximize button in floating control bar, just like the one in a normal window?


Regards,


Chun Pong

Chun Pong Lau Dec 11, 2009 - 4:59 PM

Thank you for your response.

May I have a concrete example / sample / steps to add the button?

Technical Support Dec 14, 2009 - 1:22 PM

No, unfortunately we don’t have such sample project. But this is simple to do. You should create your own CExtControlBar-derived class and override the CExtControlBar::OnNcAreaButtonsReinitialize() virtual method in it. Your method should look like:

void C_YOUR_ControlBar_CLASS_NAME::OnNcAreaButtonsReinitialize()
{
            ASSERT_VALID( this );
INT nCountOfNcButtons = NcButtons_GetCount();
            if( nCountOfNcButtons > 0 )
                        return;
            NcButtons_Add( new CExtBarNcAreaButtonClose(this) );
#if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
            NcButtons_Add( new CExtBarNcAreaButtonAutoHide(this) );
#endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
            // NcButtons_Add( new CExtBarNcAreaButtonExpand(this) );
            NcButtons_Add( new CExtBarNcAreaButtonMenu(this) );
            NcButtons_Add( new CExtBarNcAreaButtonFloatingMaximizeRestore(this) );
}

The method above is very similar to the original CExtControlBar::OnNcAreaButtonsReinitialize() method. The only difference is the last line of code:
   NcButtons_Add( new CExtBarNcAreaButtonFloatingMaximizeRestore(this) );

Prof-UIS contains the commented source code of the CExtBarNcAreaButtonFloatingMaximizeRestore class in the .../Prof-UIS/Include/ExtControlBar.h and .../Prof-UIS/Src/ExtControlBar.cpp files. You can copy this source code into your project. The CExtBarNcAreaButtonFloatingMaximizeRestore class is the beta implementation of the caption button you need.

Technical Support Dec 11, 2009 - 3:17 PM

The floating bars are really docked inside floating palette windows. These palette windows are the CExtMiniDockFrameWnd windows in Prof-UIS or CMiniDockFrameWnd windows in MFC. These windows are based on the WS_EX_TOOLWINDOW style. I.e. they are tool windows. The tool windows cannot display maximize/restore/minimize caption buttons. But you can inject your own custom buttons into the captions of Prof-UIS control bars, handle the button click and move the floating bar into the position which covers the monitor’s desktop area:

http://www.prof-uis.com/prof-uis/tech-support/faq/control-bars.aspx#how-to-add-a-custom-button-to-the-caption-of-my-control-bar