Attach a pop-up menu to a self-defined event in GLUT? - opengl

I know that with GLUT, I can create a Pop-up Menu with glutCreateMenu, glutAddMenuEntry, glutAttachMenu.
And there are three events can be used with glutAttachMenu -- "GLUT_RIGHT_BUTTON, GLUT_MIDDLE_BUTTON, GLUT_LEFT_BUTTON".
However, I want this Pop-up menu show when some other event happens, such as double-click (assuming that I have written a function DoubleClick() which will return true if there is a double-click).
How can I implement this?

Related

How do I use Spy++ on this menu that keeps disappearing if I click outside of it?

I want to log the messages of this menu using Spy++.
Usually, if I want to log the messages of a window, I would use Spy++ and drag the "Find Window" tool over it. But in this case, if I drag the tool over this menu, the menu disappears because I clicked outside it.
Is there any workaround to this?
A little more information:
What I want to achieve is finding out what messages are sent when I click the menu's items (they are buttons).
That particular menu in the first picture is created only when I click the button, and it has a different HWND every time I click it.
If I can't accomplish this in Spy++, can I do this using some other application similar to Spy++?
Actually I figured it out myself.
You can just log messages of the parent window with the logging options set to also log messages of child windows.

Overriding another windows WindowProc in C++

I'm working on a personal project where I need to invoke my function after an menu item in another process is clicked.
I'm using
BOOL enumeratingWindowsSucceeded = ::EnumWindows(enumWindowsProc, NULL);
to retrieve the handles to all of the currently open windows on my computer and using
GetSystemMenu(...)
and
AppendMenu(...)
to add an item into all the window's title bar context menu.
Now the problem is when the menu item is clicked in the other window's context menu, my program does not know about it.
Is there a way to override the WindowsProc of another window so that my process can execute some piece of code? Or is there a better way to make the menu item communicate with my program?
Thanks!

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.

Adding Menu and Submenu options to Window Menu in MAC using wXwidget C++

Hi I am new to Mac using wxWidget.
I need to add a sub menu and some menu items under the Window Menu on MAC.
I am able to do same for Window menu on PC but not on MAC.
Also, I am not getting event for click on Window Menu to the function attached with EVT_MENU_OPEN event.
Please help.
I don't really understand the question clearly. However you may have to do something like this for a menu on mac.
m_menuBar = new wxMenuBar();
#if defined(__WXMAC__)
m_menuBar->SetAppleMenuItemLabel(wxApp::s_macAboutMenuItemId, wxT("About"));
m_menuBar->SetAppleMenuItemLabel(wxApp::s_macWindowMenuItemId, wxT("Window"));
m_menuBar->SetAppleMenuItemLabel(wxApp::s_macExitMenuItemId, wxT("Quit"));
#endif
where s_macAboutMenuItemId, s_macWindowMenuItemId, s_macExitMenuItemId are your respective menu ids defined.
and regarding not getting event for click on Window Menu to the function attached with EVT_MENU_OPEN event, check if you have correct entries(Menu id, corresponding function name) in the declared event table.

WinApi C++, How to open a window push down a button?

I have created a "check Box " window with a button, when the button is clicked, It should open a "Edit" window, How can I do?
thanks
It depends completely on the windowing system you are using, or the graphics library. ¿Are you using .NET? ¿MFC?
In any case, your button object will have a way to associate a function to its click event. Just write a function that does what you need (in this case, open the "Edit" window), associate this function to the click event of your button, and you are done.
Make your edit window hidden by default in the resource editor and show it with ShowWindow(hEditWnd,SW_SHOW) when the button is clicked.
You could instanciate a new window and show it on the click event