Asked by:
How to create popup listbox?

Question
-
Hi,
In my MDI application I have a button in a CDockablePane. When clicking the button I have diaply a popup listbox with image and text.
Is it possible to create popup listbox by subclassing CListBox?
Monday, December 3, 2018 7:10 AM
All replies
-
Hello,
when you click the button you can open a CDialog without frame which is fully occupied by a listbox control. To get it to the appropiate position, you could use the button coordinates and SetWindowPos.
Regards, Guido
Monday, December 3, 2018 7:20 AM -
Hello,
when you click the button you can open a CDialog without frame which is fully occupied by a listbox control. To get it to the appropiate position, you could use the button coordinates and SetWindowPos.
Regards, Guido
Monday, December 3, 2018 7:24 AM -
Without dialog can we create a popup listbox by subclassing CListbox?
IMO, CListbox is a control in a dialog, it is not a dialog. So: no, you cannot.
Look at this: https://docs.microsoft.com/cpp/mfc/hierarchy-chart
Monday, December 3, 2018 7:32 AM -
In my MDI application I have a button in a CDockablePane. When clicking the button I have diaply a popup listbox with image and text.
Is it possible to create popup listbox by subclassing CListBox?
- Proposed as answer by Jack Zhang - AAA Monday, December 3, 2018 9:47 AM
Monday, December 3, 2018 8:30 AM -
Controls expect to be child windows. For example, they send notifications to their parent windows. So a control that is not a child window will probably exhibit unusual behavior.
- Edited by RLWA32 Monday, December 3, 2018 12:46 PM
- Proposed as answer by Jack Zhang - AAA Thursday, December 13, 2018 7:44 AM
Monday, December 3, 2018 12:45 PM -
You could create a WS_POPUP CWnd and create a CListCtrl as a child of this CWnd.
See the sample here:
https://1drv.ms/u/s!AsUFbfkvUEyfjVNbQygstiu_Qb3X-Seetharam
- Proposed as answer by Jack Zhang - AAA Thursday, December 13, 2018 7:44 AM
Monday, December 3, 2018 6:54 PM -
Hello,
Have you got any updates? If your case has been solved, please help to mark answers. If not, just feel free to contact us.
Your understanding and cooperation will be grateful.
Best Regards,
Jack
MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
Friday, January 4, 2019 6:47 AM