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 » CExtColorPaletteWnd question Collapse All
Subject Author Date
tera tera Mar 25, 2009 - 1:34 AM

I ask for advice.

In reference to CExtColorPaletteWnd, I think about making with a variable button.


Technical Support Mar 25, 2009 - 11:10 AM

The CExtColorPaletteWnd control uses items of equal sizes. You should use the toolbar control instead. First of all please create your own CExtToolControlBar-derived class which implements the following virtual methods:

               virtual CExtBarContentExpandButton * OnCreateBarRightBtn()
                        {
                                    ASSERT_VALID( this );
                                    return NULL; // We do not need the chevron button in your toolbar:
                        }
                        virtual bool _GetFullRowMode() const { return true; }
                        virtual bool OnQueryMultiRowLayout() const { return true; }
                        virtual bool IsBarWithGripper( bool * pbGripperAtTop = NULL, bool * pbTextOnGripper = NULL ) const { pbGripperAtTop; pbTextOnGripper; return false; }

Then please create your CExtToolControlBar-based control inside tab page container instead of the CExtColorPaletteWnd control. Then you can initialize toolbar buttons instead of the color palette items. The toolbar control supports buttons of variable sizes.

tera tera Mar 25, 2009 - 6:43 PM

Hello.


 




I want to start a new line from the very last button of the group button in a line.

In ToolMenu, will such a thing be possible?


In addition, I do not understand the registration of the button.

Do you perform LoadMenu?

Or do you make ExtBarButton every 1 button?


 

Technical Support Mar 26, 2009 - 6:04 AM

The multi row layout toolbars we advised you in our previous answer do not support user defined row wrapping. The multi row layout toolbars are toolbars which are using layout and behavior of menu bar. So, you need another solution. Fortunately it exists and it’s also based on the toolbar control.
Please take a look at the CMainFrame::m_wndPalette window in the DRAWCLI sample application. This is the dockable CExtToolControlBar toolbar control switched into the palette mode. The toolbars in palette mode support independent button layout in horizontally docked, vertically docked and floating states. In each state, the layout of buttons in such palette toolbar is organized into rows. The last button in each row is marked with the wrap flag. Here is how the toolbar control in palette mode is initialized in the CMainFrame::OnCreate() method of the DRAWCLI sample application:

   m_wndPalette.m_bPaletteMode = true;
            if( !m_wndPalette.Create(
                                    NULL,
                                    this,
                                    ID_VIEW_PALETTE
                                    )
                        ||
                        !m_wndPalette.LoadToolBar(IDR_TOOLBAR_HELPER_ICONS)
                        )
            {
                        TRACE0("Failed to create m_wndPalette toolbar\n");
                        return -1;      // fail to create
            }
            m_wndPalette.InsertButton();
            nBtnIdx = m_wndPalette.GetButtonsCount();
            m_pBtnColorFillP =
                        new CExtBarColorButton(
                                    &m_wndPalette,
                                    ID_OBJECT_FILLCOLOR, 0, COLORREF(-1), RGB(0,0,0),
                                    ID_OBJECT_FILLCOLOR, true, true,
                                    (LPCTSTR)sNoFill, NULL,
                                    CExtBarColorButton::__DIT_CHAR_2007
                                    );
            m_pBtnColorFillP->SetSeparatedDropDown();
            VERIFY(
                        m_wndPalette.InsertSpecButton(
                                    nBtnIdx,
                                    m_pBtnColorFillP,
                                    FALSE
                                    )
                        );
            nBtnIdx++;
            m_pBtnColorOutlineP =
                        new CExtBarColorButton(
                                    &m_wndPalette,
                                    ID_OBJECT_LINECOLOR, 0, COLORREF(-1), RGB(0,0,0),
                                    ID_OBJECT_LINECOLOR, true, true,
                                    (LPCTSTR)sNoOutline, NULL,
                                    CExtBarColorButton::__DIT_FRAME
                                    );
            VERIFY(
                        m_wndPalette.InsertSpecButton(
                                    nBtnIdx,
                                    m_pBtnColorOutlineP,
                                    FALSE
                                    )
                        );
            m_wndPalette.GetButton(  3 )->SetWrap( CExtBarButton::__EVT_HORZ );
            m_wndPalette.GetButton(  8 )->SetWrap( CExtBarButton::__EVT_HORZ );
            m_wndPalette.GetButton( 14 )->SetWrap( CExtBarButton::__EVT_HORZ );
            m_wndPalette.GetButton(  3 )->SetWrap( CExtBarButton::__EVT_VERT );
            m_wndPalette.GetButton(  6 )->SetWrap( CExtBarButton::__EVT_VERT );
            m_wndPalette.GetButton(  9 )->SetWrap( CExtBarButton::__EVT_VERT );
            m_wndPalette.GetButton( 12 )->SetWrap( CExtBarButton::__EVT_VERT );
            m_wndPalette.GetButton( 14 )->SetWrap( CExtBarButton::__EVT_VERT );
            m_wndPalette.GetButton(  3 )->SetWrap( CExtBarButton::__EVT_FLOAT );
            m_wndPalette.GetButton(  5 )->SetWrap( CExtBarButton::__EVT_FLOAT );
            m_wndPalette.GetButton(  7 )->SetWrap( CExtBarButton::__EVT_FLOAT );
            m_wndPalette.GetButton(  9 )->SetWrap( CExtBarButton::__EVT_FLOAT );
            m_wndPalette.GetButton( 11 )->SetWrap( CExtBarButton::__EVT_FLOAT );
            m_wndPalette.GetButton( 14 )->SetWrap( CExtBarButton::__EVT_FLOAT );

You can just create a non-dockable toolbar with palette mode as a child of a resizable control bar.
Even more, a toolbar control in palette mode supports separator buttons which automatically look like horizontal or vertical separators depending on the palette toolbar layout. You can see such separators in the palette mode toolbar in DRAWCLI sample application. You can use these separators to for highlighting differences between group of buttons displayed on your schematic screen shots.
Please note, the toolbar buttons are based on the command identifiers registered in the command manager. So, you may need to allocate required number of command identifiers in the command manager using the g_CmdManager->CmdAllocPtr() code (the CExtCmdManager::CmdAllocPtr() method) before inserting them into your palette toolbar as palette items.
The CMainFrame::m_wndPalette window in the DRAWCLI sample application is initialized via loading set of buttons from the toolbar resource. Then the set of code lines like m_wndPalette.GetButton( . . . ) -> SetWrap( . . . ) is invoked for assigning wrapping flags to toolbar buttons. You will need to initialize toolbar with buttons manually using the CExtToolControlBar::InsertButton() method and specifying pre-allocated in the command manager identifier in parameters.
If you have any difficulties with this task, please let us know.