Gtk2: event for top menu item click? - gtk2

I want to see how to make it in Gtk2 (e.g. C++). Does gtk2 has ability to set event which is called, when top menu item is clicked?
E.g. topmenu may be "File Edit Help". When "Edit" clicked (Alt+E key too) I want that event is called (event sets checkmarks for menu items in Edit).
How to do it.

You can "trap" them with activate-current. As most of the widgets, they have an activated signal handler.

Related

How to force LVN_HOTTRACK to always fire even when a CMenu is currently open

This is my scenario:
I have a CListCtrl which I show a CMenu upon right click, by using CMenu::TrackPopupMenu.
And then, I also have the event handler LVN_HOTTRACK in which I store the current item index of the list control, which updates it every mouse move.
Next, on the menu items of CMenu mentioned in #1, I have the UPDATE_COMMAND_UI event handler, where I check some conditions, then enable/disable the corresponding menu item.
Now, LVN_HOTTRACK works as expected, except when the CMenu is shown/open. I tested this by updating the title bar to "0" on UPDATE_COMMAND_UI, while I set it to "1" during LVN_HOTTRACK, and noticed that no matter how many times I move the mouse while the menu is open, it never updates to "1".
Additional info:
I tried calling SetForegroundWindow() first before calling TrackPopupMenu() and behavior is the same.
EDIT:
My question would be:
How would I let the LVN_HOTTRACK fire always, that it would not be blocked by the menu being open?
What I'm trying to do is enable/disable the menu item, which are "Move up", which switches the selected list item with the item above it, and "Move down" which switches with the list item below.
The customer requirement is that I should have a context/right-click menu, and not have buttons to switch items.
If the selected list item is the topmost item, "Move up" should be disabled, and if the selected list item is the bottom most item, "Move down" should be disabled. And enabling/disabling these menu items as far as I understand is done in UPDATE_COMMAND_UI.
As I understand it the menu window (an internal popup controlled by the system) performs a mouse capture, your list is not going to receive any mouse related events until that goes away.

How to set signal to a button of the GtkColorChooserDialog composite widget?

I am using Glade to create GUI. I have the default GtkColorChooserDialog.
How to set signals to the Select and Cancel button clicked event.
These two buttons are grouped in one GtkButtonBox and I can only choose the box, but not the buttons themselves.
If I can't select the button then how to assign action to the clicked signal?

Dynamic Menu in Qt Application

I have a bunch of Dock Widgets that the User is free to close and want to provide a menu in my QMenuBar that reopens each of them individually. So possibly every time the menu is opened, the list of options will be different.
Is there any event or hook that I can use to recreate the menu whenever it is opened? The only thing I could find was the triggered event, but that is only generated after I already selected something.
Otherwise I would have to monitor all dock widget actions or I could use a timer that periodically recreates the menu - both solutions don't sound very appealing.

Combo box in vb6 firing on click before i select any item

I have a vb6 application which has a combo box on it, on this combo box _click event i have written some code but noticed that this event is firing even when i open the list of items in combo box, i have other combo boxes in my application as well they all fire _click when an item is select from list not when the list is opening.
Thanks
You almost certainly meant to handle the Change event, not the Click event.
There are 3 type of combo box in vb6, choose the right style for a combo to get the beahviour you want in property window of a combo box, Source:
http://visual-basic.itags.org/visual-basic/82371/

Creating popup menu in Qt for QTableView

I have a QTableView in the main UI of my program. I'd like to show popup menu when user right clicks on the cells of the table and take appropriate action when an option is selected from the menu.
I am using Qt Creator 1 (Qt version 4.5). How can I do that?
Check out the customContextMenuRequested signal to get the event, and use a QMenu for the menu itself. Use QTableView::indexAt to find out what, if any, cell was clicked based on the coordinates given to the signal and take the appropriate action when a menu item is clicked.