Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

popup menu on the combobox

Posted on 1997-07-13
2
Medium Priority
?
413 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
  • 2
2 Comments
 
LVL 3

Accepted Solution

by:
jaba earned 20 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

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

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

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. …
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Suggested Courses
Course of the Month5 days, 18 hours left to enroll

772 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