Print Page | Close Window

CXTColorPicker 'Automatic' color

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=5053
Printed Date: 11 November 2025 at 7:33am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: CXTColorPicker 'Automatic' color
Posted By: DaveS
Subject: CXTColorPicker 'Automatic' color
Date Posted: 14 September 2006 at 2:00pm
 
I am using a CXTColorPicker, but the top portion of the color selector that says either ‘Automatic’ or ‘No Fill’ doesn’t make sense in my application. However I can find no way to disable it. I can comment out the code that creates it in CXTColorSelectorCtrl, but then that leaves an awkward-looking gap. Can that top portion of the selector be made optional?

 BTW, the ‘Automatic’ color doesn’t seem to work – it always shows black no matter what the default color is.




Replies:
Posted By: Ark42
Date Posted: 14 September 2006 at 8:47pm
It is up to you to code what Automatic does, but there isn't an option I saw to remoev the button if you don't want it. What I did was basically copy a little bit and modify from the CodeJock source:

//.h file
class CXTColorPickerEx : public CXTColorPicker
{
    DECLARE_DYNAMIC(CXTColorPickerEx)
public:
    afx_msg void OnShowPopup();
    DECLARE_MESSAGE_MAP()
};
class CXTColorPopupEx : public CXTColorPopup
{
protected:
    afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
    DECLARE_MESSAGE_MAP()
};

//.cpp file

const UINT WM_XT_SHOWPOPUP = (WM_XTP_CONTROLS_BASE + 29);

IMPLEMENT_DYNAMIC(CXTColorPickerEx, CXTColorPicker)

BEGIN_MESSAGE_MAP(CXTColorPickerEx, CXTColorPicker)
    ON_MESSAGE_VOID(WM_XT_SHOWPOPUP, OnShowPopup)
END_MESSAGE_MAP()

void CXTColorPickerEx::OnShowPopup()
{
    CRect rcWindow;
    GetWindowRect(&rcWindow);

    CXTColorPopupEx *pColorPopup = new CXTColorPopupEx(TRUE, 0); //use Ex version
    pColorPopup->Create(rcWindow, this, m_dwPopup, GetColor(), GetDefaultColor());
    pColorPopup->SetFocus();
}

BEGIN_MESSAGE_MAP(CXTColorPopupEx, CXTColorPopup)
    ON_WM_CREATE()
END_MESSAGE_MAP()

int CXTColorPopupEx::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
    m_rcBorders.top -= 27;

    CXTColorPopup::OnCreate(lpCreateStruct);

    CRect rect;
    GetWindowRect(&rect);
    rect.bottom -= 27;
    MoveWindow(rect, FALSE);

    return 0;
}



Posted By: DaveS
Date Posted: 15 September 2006 at 11:35am
 
That worked great! Thanks!
 



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net