the list of the combobox 
Author Message
 the list of the combobox

I have a dialog that has a combobox on it and I need to know when the left
mouse button is pressed on the list of the combobox.
So on the PreTranslateMessage of the mainframe I wrote the following code:

BOOL CMainFrame::PreTranslateMessage(MSG* pMsg)
{
 CWnd* pWnd ;
 switch (pMsg->message) {
 case WM_LBUTTONDOWN:
  if (CUiMiniDialog::GetMiniDialog() != NULL )
  {
   CUiMiniDialog * pMiniDlg = CUiMiniDialog::GetMiniDialog() ;
   pWnd = FromHandle( pMsg->hwnd );
   ASSERT(pWnd) ;
   if (pMiniDlg->IsChild(pWnd))
    pMiniDlg->do_some_thing () ;
  }
  break ;

Quote:
}

but IsChild does not return true when I press on the combobox list.
Can any one help!!

please send email as well.
Thanks
yoram



Sun, 10 Dec 2000 03:00:00 GMT  
 the list of the combobox

    Catch it in the PreTranslateMessage for the dialog instead. - Doug S.

Quote:

> I have a dialog that has a combobox on it and I need to know when the left
> mouse button is pressed on the list of the combobox.
> So on the PreTranslateMessage of the mainframe I wrote the following code:

> BOOL CMainFrame::PreTranslateMessage(MSG* pMsg)
> {
>  CWnd* pWnd ;
>  switch (pMsg->message) {
>  case WM_LBUTTONDOWN:
>   if (CUiMiniDialog::GetMiniDialog() != NULL )
>   {
>    CUiMiniDialog * pMiniDlg = CUiMiniDialog::GetMiniDialog() ;
>    pWnd = FromHandle( pMsg->hwnd );
>    ASSERT(pWnd) ;
>    if (pMiniDlg->IsChild(pWnd))
>     pMiniDlg->do_some_thing () ;
>   }
>   break ;
> }

> but IsChild does not return true when I press on the combobox list.
> Can any one help!!

> please send email as well.
> Thanks
> yoram



Sun, 10 Dec 2000 03:00:00 GMT  
 the list of the combobox

Quote:

> I have a dialog that has a combobox on it and I need to know when the left
> mouse button is pressed on the list of the combobox.
> So on the PreTranslateMessage of the mainframe I wrote the following code:

> BOOL CMainFrame::PreTranslateMessage(MSG* pMsg)
> {
...snip
> }

> but IsChild does not return true when I press on the combobox list.
> Can any one help!!

The listbox in a combobox is not a child window, it's a popup.  See if
the CBN_SELCHANGE notification does what you need.  Otherwise you will
have to get the handle of the listbox within the combo and then subclass
it.  -steve


Sun, 10 Dec 2000 03:00:00 GMT  
 the list of the combobox

Doug,
I would make the control CMyComboBox derived form CComboBox and just add the
message handler for OnLButtonDown message.
Jim

Quote:

>    Catch it in the PreTranslateMessage for the dialog instead. - Doug S.


>> I have a dialog that has a combobox on it and I need to know when the
left
>> mouse button is pressed on the list of the combobox.
>> So on the PreTranslateMessage of the mainframe I wrote the following
code:

>> BOOL CMainFrame::PreTranslateMessage(MSG* pMsg)
>> {
>>  CWnd* pWnd ;
>>  switch (pMsg->message) {
>>  case WM_LBUTTONDOWN:
>>   if (CUiMiniDialog::GetMiniDialog() != NULL )
>>   {
>>    CUiMiniDialog * pMiniDlg = CUiMiniDialog::GetMiniDialog() ;
>>    pWnd = FromHandle( pMsg->hwnd );
>>    ASSERT(pWnd) ;
>>    if (pMiniDlg->IsChild(pWnd))
>>     pMiniDlg->do_some_thing () ;
>>   }
>>   break ;
>> }

>> but IsChild does not return true when I press on the combobox list.
>> Can any one help!!

>> please send email as well.
>> Thanks
>> yoram



Mon, 11 Dec 2000 03:00:00 GMT  
 the list of the combobox

Try this function insted of using pretrasnlate message

CWnd::SubclassDlgItem
BOOL SubclassDlgItem( UINT nID, CWnd* pParent );

Return Value
Nonzero if the function is successful; otherwise 0.

Parameters
nID   The control's ID.
pParent   The control's parent (usually a dialog box).

Remarks
Call this member function to "dynamically subclass" a control created from a
dialog template and attach it to this CWnd object. When a control is
dynamically subclassed, windows messages will route through the CWnd's message
map and call message handlers in the CWnd's class first. Messages that are
passed to the base class will be passed to the default message handler in the
control.

This member function attaches the Windows control to a CWnd object and
replaces the control's WndProc and AfxWndProc functions. The function stores
the old WndProc in the location returned by the GetSuperWndProcAddr member
function.

Quote:

> I have a dialog that has a combobox on it and I need to know when the left
> mouse button is pressed on the list of the combobox.
> So on the PreTranslateMessage of the mainframe I wrote the following code:

> BOOL CMainFrame::PreTranslateMessage(MSG* pMsg)
> {
>  CWnd* pWnd ;
>  switch (pMsg->message) {
>  case WM_LBUTTONDOWN:
>   if (CUiMiniDialog::GetMiniDialog() != NULL )
>   {
>    CUiMiniDialog * pMiniDlg = CUiMiniDialog::GetMiniDialog() ;
>    pWnd = FromHandle( pMsg->hwnd );
>    ASSERT(pWnd) ;
>    if (pMiniDlg->IsChild(pWnd))
>     pMiniDlg->do_some_thing () ;
>   }
>   break ;
> }

> but IsChild does not return true when I press on the combobox list.
> Can any one help!!

> please send email as well.
> Thanks
> yoram



Tue, 12 Dec 2000 03:00:00 GMT  
 the list of the combobox

You can subclass the combo box and then trap the WM_CTLCOLORLISTBOX message
which has the window handle of the listbox as one of it's parameters.

Regards,
Edwin Schild



Mon, 18 Dec 2000 03:00:00 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. the list of the combobox

2. Subclassing List portion of ComboBox problem

3. the list of the combobox

4. How do you get an enumeration list bound to a combobox on a winform

5. ComboBox List - like property definition in IDL

6. ComboBox Messages (When mouse is being move over the list box)

7. ComboBox list there, but not showing -- help!

8. Get the list window of a combobox

9. Get the list window of a combobox

10. PLEASE READ!!! Highlighted item in combobox drop list

11. Combobox List

12. How to get combobox list from variables?

 

 
Powered by phpBB® Forum Software