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 » How to handle childwindow notification? Collapse All
Subject Author Date
Lee JongHee Aug 17, 2003 - 7:38 PM

I have CExtControlBar derived class which has one listbox for childwindow.
It derived like this..

CScrollExtWBR< CExtWFF< CListBox > > m_wndInBarListBox;

My problem is don’t know how to handle the notification message for listbox, like ON_LBN_DBLCLK.
I’ve searched through samples, but I think there is no matching case for this.

Sergiy Lavrynenko Aug 18, 2003 - 9:42 AM

Hi,

The ON_LBN_DBLCLK macro is normally used in the parent window of a list-box to catch the WM_COMMAND-based notification with the LBN_DBLCLK event code. You can catch this message in the same list-box if you will use your own class derived from CScrollExtWBR< CExtWFF< CListBox > > or simply from CListBox and add the ON_CONTROL_REFLECT( LBN_DBLCLK, MyHandlerMedhodInMyListBox ) into its message map. I think this way is the most convenient.

Another way is also based on CListBox-derived class. You can add the standard OnLButtonDblClick() handler using class wizard, then call OnLButtonDblClick() of the parent class and then analyze the mouse pointer position and perform any operations.

Third way is overriding of the PreTranslateMessage() of your list-box.

Best regards,
Sergiy.

Lee JongHee Aug 18, 2003 - 7:55 PM

Thanks for your advice.
Since childwindow get all the message from it after first click,my derived controlbar can not receive any message from childwindow after LBN_SETFOCUS.
So I Pretranslate it. It works..

//from CExtControlBar class
virtual BOOL PreTranslateMessage(MSG* pMsg)
{
if(pMsg->message == WM_LBUTTONDBLCLK)
{
CWnd* wndList = GetDlgItem(GetDlgCtrlID());
if(wndList)
((CListBox*)wndList)->AddString("Succeeded..");
}
return CExtControlBar::PreTranslateMessage(pMsg);
}

Thanks for kind advice.