Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - CXTColorPicker 'Automatic' color
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

CXTColorPicker 'Automatic' color

 Post Reply Post Reply
Author
Message Reverse Sort Order
DaveS View Drop Down
Groupie
Groupie


Joined: 18 February 2005
Status: Offline
Points: 24
Post Options Post Options   Thanks (0) Thanks(0)   Quote DaveS Quote  Post ReplyReply Direct Link To This Post Topic: CXTColorPicker 'Automatic' color
    Posted: 15 September 2006 at 11:35am
 
That worked great! Thanks!
 
Back to Top
Ark42 View Drop Down
Senior Member
Senior Member
Avatar

Joined: 20 October 2003
Status: Offline
Points: 291
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ark42 Quote  Post ReplyReply Direct Link To This Post 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;
}

Back to Top
DaveS View Drop Down
Groupie
Groupie


Joined: 18 February 2005
Status: Offline
Points: 24
Post Options Post Options   Thanks (0) Thanks(0)   Quote DaveS Quote  Post ReplyReply Direct Link To This Post 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.

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.047 seconds.