Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

popup menu on the combobox

Posted on 1997-07-13
2
Medium Priority
?
398 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 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
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.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

715 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