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 General Discussion » CExtColorButton + CExtToolControlBar Collapse All
Subject Author Date
Sebstian Leopold Aug 2, 2006 - 10:41 AM

Hello,

I have tried to setup an CExtColorButton inside a CExtToolControlBar. It works and the Buttons displays correctly, but when I select any color nothing happens. Also the choos custom color dialog does not appear on the screen when I choos this menu point.

regards.

William Henry Nov 27, 2022 - 11:50 PM

Did you try toolbar light theme, I think you are using dark style for your toolbar that’s why menu items shows in black https://trap-thecat.com

Technical Support Aug 2, 2006 - 1:07 PM

The CExtColorButton class implements the button control displaying the color popup menu. The CExtColorButton class is derived from the CExtButton class. Both CExtColorButton and CExtColorButton classes are designed for using as button controls in dialogs and other windows. Both of them are HWND-based UI elements. Of course, you can create these windows inside a CExtToolControlBar window and use them, but we recommend you use the non HWND-based toolbar buttons instead. Each toolbar button is an instance of the CExtBarButton class or derived from it. The CExtBarColorButton class implements the color picker button in toolbar like you need. This class is used in the DRAWCLI sample for selecting fill and border colors of drawn document objects. The CMainFrame class has the following members:

    CExtBarColorButton * m_pBtnColorFillS, * m_pBtnColorOutlineS;
They are initialized in the CMainFrame::OnCreate() method:
    m_pBtnColorFillS =
        new CExtBarColorButton(
            &m_wndToolBarStandard,
            ID_OBJECT_FILLCOLOR, 0, COLORREF(-1), RGB(0,0,0),
            ID_OBJECT_FILLCOLOR, true, true,
            (LPCTSTR)sNoFill, NULL,
            CExtBarColorButton::__DIT_CHAR
            );
    m_pBtnColorFillS->SetSeparatedDropDown();
    VERIFY(
        m_wndToolBarStandard.InsertSpecButton(
            nBtnIdx,
            m_pBtnColorFillS,
            FALSE
            )
        );
    
    nBtnIdx = m_wndToolBarStandard.CommandToIndex(ID_OBJECT_LINECOLOR);
    m_wndToolBarStandard.SetButtonCtrlVisibleVertically( nBtnIdx, true );
    VERIFY(
        m_wndToolBarStandard.RemoveButton(
            nBtnIdx,
            FALSE
            )
        );
    m_pBtnColorOutlineS =
        new CExtBarColorButton(
            &m_wndToolBarStandard,
            ID_OBJECT_LINECOLOR, 0, COLORREF(-1), RGB(0,0,0),
            ID_OBJECT_LINECOLOR, true, true,
            (LPCTSTR)sNoOutline, NULL,
            CExtBarColorButton::__DIT_FRAME
            );
    VERIFY(
        m_wndToolBarStandard.InsertSpecButton(
            nBtnIdx,
            m_pBtnColorOutlineS,
            FALSE
            )
        );
The color changing and custom color button clicking events are also handled by the main frame window:
    // color popup menu
    ON_REGISTERED_MESSAGE(
        CExtPopupColorMenuWnd::g_nMsgNotifyColorChangedFinally,
        OnColorChangedFinally
        )
    ON_REGISTERED_MESSAGE(
        CExtPopupColorMenuWnd::g_nMsgNotifyCustColor,
        OnColorSelectCustom
        )
 
LRESULT CMainFrame::OnColorChangedFinally(WPARAM wParam, LPARAM lParam)
{
    . . .
}
 
LRESULT CMainFrame::OnColorSelectCustom(WPARAM wParam, LPARAM lParam)
{
    . . .
}
But the DRAWCLI sample is an MDI project. That is why the CMainFrame::OnColorChangedFinally() and CMainFrame::OnColorSelectCustom() handler methods are re-sending the CExtPopupColorMenuWnd::g_nMsgNotifyColorChangedFinally and CExtPopupColorMenuWnd::g_nMsgNotifyCustColor color notification messages into the active view window in the MDI environment. You can do the same in the SDI environment or handle color notification messages in the main frame window. In the DRAWCLI sample application you can see the same handler methods implemented in the CDrawView class class. The CDrawView::OnColorChangedFinally() method changes the color of selected objects when the color cell in the popup menu is clicked. The CDrawView::OnColorSelectCustom() method posts the command messages for displaying the color picker dialog.

Betty Cooper Nov 21, 2022 - 11:38 PM

The solution is to change the color of the buttons in your theme. You can do this by going to the Appearance > Themes menu and selecting the theme you want to use. Then go to the Appearance > Customize menu and click on the Color tab. https://mapquestdrivingdirections.app