ComboBox + DropDown List - context menu for list items?...

ComboBox + DropDown List - context menu for list items?...

Post by Jurij Kowa » Wed, 23 Aug 2006 11:53:50


Hi.

I wanted to add context-menu to each of the items of my DropDown List.
See example image:

http://www.yqcomputer.com/

I mean, I wanted a small popup-menu to occur when I click with RMB on
some item from the list (say, 'Collection' <- see screenshot above).
The problem is that open dropdown-list-window seems to ignore RMB clicks
(or any other mouse-actions other than selecting an item which causes
the list to close itself). Is there any possibility to 'catch' RMB
clicks in DropDown-List window?...

The other problem is that I wanted to add some 'disabled' items to the
list. They would be visible, but not selectable (the user can click on
it, but nothing happens -> the dropdown list is not being closed). Is
there any way to 'check' if the item is selectable before the list is
closed?...

With regards,
mixcherry
 
 
 

ComboBox + DropDown List - context menu for list items?...

Post by Bertel Bra » Thu, 24 Aug 2006 03:57:59


Normally you can do it by subclassing your control, but a Combo-box
is tree windows, and to get the list-box (the drop down part) is
not that easy, see:
http://www.yqcomputer.com/


You could handle CBN_SELENDOK or CBN_CLOSEUP or CBN_SELCHANGE and select
the previous item, if the selected item is a disabled one.

--
Absolutely not the best homepage on the net:
http://www.yqcomputer.com/
But it's mine - Bertel

 
 
 

ComboBox + DropDown List - context menu for list items?...

Post by Jurij Kowa » Fri, 25 Aug 2006 09:42:37

Bertel Brander napisa?a):

Thank you for your answer! I've (finally) been able to catch RMB click
on list item (after subclassing the combobox, then subclassing listbox
on WM_CTLCOLORLISTBOX).

But there's another problem: when I right-click on ListBox item and
display the popup-menu (using TrackPopupMenu()), the ListBox immediately
closes itself... I would like the ListBox window to stay open until I
choose something from popup-menu.

Is it possible to somehow *block* ListBox (so it doesn't close) AND show
popup-menu - at the same time?

With regards,
mixcherry
 
 
 

ComboBox + DropDown List - context menu for list items?...

Post by NoSpa » Fri, 25 Aug 2006 21:35:04

On Tue, 22 Aug 2006 04:53:50 +0200, Jurij Kowal <poczta.onet.pl@fanin>



I had a similar problem recently, where I wanted to provide
right-click Help on edit controls (which normally just pop up
the standard Cut/Copy/Paste menu). Since I had hundreds
of controls to handle, I didn't want to subclass. I ended up
trapping WM_RBUTTONDOWN in the main message loop.
If it was for one of my controls, I ate that message and
posted WM_CONTEXTMENU instead. I wonder if you
could use the same idea here, and basically just do whatever
you want after eating the click.

Best regards,




Bob Masta
dqatechATdaqartaDOTcom

D A Q A R T A
Data AcQuisition And Real-Time Analysis
www.daqarta.com
Home of DaqGen, the FREEWARE signal generator
 
 
 

ComboBox + DropDown List - context menu for list items?...

Post by Bertel Bra » Sat, 26 Aug 2006 06:57:10


Clever solution!


I don't know. There is CBN_CLOSEUP but it's send after the list has
closed, so it is to late. But, as you has sub-classed the two
windows of interest, you could trace what happens just before this
message is received in the parent window. You might be able to handle
the message that caused the list to be closed, an thus prevent the
list from closing. I don't know if the list or the combo-box
decides to close the list.

--
Absolutely not the best homepage on the net:
http://www.yqcomputer.com/
But it's mine - Bertel