Solved

popup menu on the combobox

Posted on 1997-07-13
2
385 Views
Last Modified: 2013-11-20


 Dear Jaba,

 everything seems to work fine, except the fact that the function EnumChildWindows() can retrieve either the entry field part of the combo or the listbox part of it. I wanted the popup to be sensitive only to the entry field part, how can I get the window class for the particular window retrieved? I'm not relying on GetStyle(), I want to check if the window is an entry field.
0
Comment
Question by:login
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 3

Accepted Solution

by:
jaba earned 10 total points
ID: 1302556
Well. To do field sensitive popup menu you need subclass lisbox  arriving from combobox too. You can do this by following steps.
First , you need make class CMyListBox derived from CListBox. In this class you need dispatch OnRButtonDown. In last answer i advise to send WM_RBUTTONDOWN from edit control to combobox. In this case , to separate WM_RBUTTONDOW from listbox and edit you need uto use flag in static variable or, may be, use registred message instead of WM_RBUTTONDOWN .

Well , continue. Now we need dispatch event of lisbox appearing. You can do it :
BOOL CMyComboBox::OnChildNotify(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* lpResult)
{
    if(message == WM_COMMAND){
        if(HIWORD(lParam) == CBN_DROPDOWN){
            ASSERT(wParam == (UINT) GetDlgCtrlID() && LOWORD(lParam) == (UINT) m_hWnd);
            PostMessage(msgGetComboLBox);
/* I am posting user registred message to myself , This is signal  to subclass lisbox */

        } else if(HIWORD(lParam) == CBN_CLOSEUP){
            ASSERT(wParam == (UINT) GetDlgCtrlID() && LOWORD(lParam) == (UINT) m_hWnd);
            m_ComboList.DetachWindow();
        }
    }
    return CComboBox::OnChildNotify(message, wParam, lParam, lpResult);
}

When dispatching this signal message
LRESULT CMyComboBox::OnGetComboLBox(WPARAM, LPARAM)
{
    ASSERT(m_ComboList.m_hWnd == NULL);
    VERIFY(m_ComboList.SubclassWindow(::FindWindow("ComboLBox", NULL)));
/* !!!!!! Look to this . There is only ONE lisbox arriveed from combobox in System !!!! */
    return 0;
}

After this you have 2 subclassed subitems of combobox and you can separate rbuttondown from they

                       
0
 
LVL 3

Expert Comment

by:jaba
ID: 1302557
Hmm, what about accept or reject this answer :-)
0

Featured Post

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
wait notify demo infinite loop 3 151
sumHeights2  challenge 7 140
wordmultiple challenge 12 170
Example code 13 43
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question