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 Collapse All
Subject Author Date
David Jun 14, 2002 - 11:26 AM

Hi,

I am using CExtColorButton, and wanted to triggered an action when the button is clicked (simply to get the color out of the selection).

I did the change in your prof-uis control example:

ON_BN_CLICKED(IDC_BUTTON_COLOR1, OnColorBtn1)

Of course: the .h has the afx_msg declaration,

and my method is:

void OnColorBtn1()
{
AfxMessageBox("begin");
m_btnColor1.m_clrSelected;
AfxMessageBox("done");
}

I compile and run in debug, this method is never called. Do I do something wrong ?

Thanks,

Sergiy Lavrynenko Jun 18, 2002 - 11:36 AM

Many thanks to Mr. Buba for his remarks.

The CExtColorButton class is not designed
to send WM_COMMAND messages.
Here is the way to catch the color selection.

First, add this code to message map of the owner
window or the owner dialog:

ON_REGISTERED_MESSAGE(
CExtPopupColorMenuWnd::
g_nMsgNotifyColorChangedFinally,
OnColorChangedFinally
)

Then handle this message:

LRESULT CMyWndOwnerOfColorButton::
OnColorChangedFinally(
WPARAM wParam, LPARAM lParam
)
{
COLORREF clrNewSelection =
(COLORREF)wParam;
...
}


Buba Jun 17, 2002 - 12:02 AM

Hi
I’m not member of foss but their code is interesting to me. So...

ExtButton.cpp (line 531):

void CExtButton::_OnClick()
{
    if( _OnTrackPopup() )
return;
....

Oops :)

comment line:
//    if( _OnTrackPopup() )
// return;

and write line:
    _OnTrackPopup();

But it is rough :)
Let’s have a look at the primary source of a problem

void CExtButton::OnLButtonUp(UINT nFlags, CPoint point)
{
...
//    CButton::OnLButtonDown(nFlags, point); // ????

}

Wow, Call of a member of base class is comments
Uncomment this call and lower it in the end function
and

yse budet okey :)