I've got an MDI win32 application in Delphi.
It has many forms, all of them and their inner components have own popup menus.
After some time when application idles trigger starts and it closes all child windows.
But it doesn't close popup menu if it is showing. (For example user clickes right button and leaved computer -the popup menu should be closed also when trigger starts.)
GetWindow function doesn't find the popup menu.
How to find the popup menu and close it?
SendMessage(PopupList.Window, WM_CANCELMODE, 0, 0);
The global Menus.PopupList object manages the window that handles all messages for VCL popup menus in the application.
Related
I have a dialogue box that is:
Draggable
Modal
Requirement:
I have a requirement where I don't need to close my dialogue and have to load the different pages in the background on the selection of data from the grid that is on Dialogue.
What did I do:
I know how to open the page in the background with the help of a de-attached listener.
vehicleInfoPopUpView.addDetachListener(e -> {
UI.getCurrent().navigate(AssignmentPageContainer.class,
String.valueOf(vehicleInfoPopUpView.getCanFileNumber()));
});
The above code (in the parent page) loads/opens a new page but to do this I have to close my dialogue box (which I don't have to do, I have to keep the dialogue box open).
I cannot find any resource that tells me How to load/open a new page in the background from the dialogue box without closing it
Any small help! Thanks for the help in advance.
First of all: Don't.
Keeping a modal dialog open whilst navigating to a different page/route makes no UX sense. A modal window means you cannot interact with the background.
Just call UI.getCurrent().navigate(AssignmentPageContainer.class) directly (outside of detach listener) to open the view based on the selection. The user will open the dialog again himself, if he will want to. You can trigger this on some button click.
Secondly, as a workaround you could store the state of the dialog in a #UIScoped service and open & reinitialize the dialog f.e. in the afterNavigation method.
I've got an MDI win32 application in Delphi.
It has many forms, all of them and their inner components have own popup menus.
After some time when application idles trigger starts and it closes all child windows.
But it doesn't close popup menu if it is showing. (For example user clickes right button and leaved computer -the popup menu should be closed also when trigger starts.)
GetWindow function doesn't find the popup menu.
How to find the popup menu and close it?
SendMessage(PopupList.Window, WM_CANCELMODE, 0, 0);
The global Menus.PopupList object manages the window that handles all messages for VCL popup menus in the application.
Creating a new Delphi Vcl Forms Application.
Drop TRibbon
Drop ActionManager
Connect Between them.
Right click the Ribbon1 to add Tabs and Groups.
Right click the Ribbon1 to add Application Menu.
In the Object Inspector choose the Ribbon1, and set BidiMode to bdRightToLeft.
Run.
The Form that is created is deffrent from design time, as the application menu covers the Close Appliaction button.
What can be done to lower the Application Button?
When I make a right click in a TMemocomponent the system display a popup menu like this
but when I use a TSynEdit component this popup menu is not shown, the question is exist any way to activate this system popup menu in a TSynEdit component or do I have to implement myself a right-click popup menu for the TSynEdit component to get right-click Cut,Copy,Paste,Delete functionality ?
The popup menu you're showing is added by Windows itself to Edit controls (TMemo is a wrapper around a multiline Edit control). Since SynEdit isn't based on the Windows Edit control, but is implemented fully itself, Windows doesn't provide that menu.
If SynEdit doesn't provide a popup menu itself, you'll have to implement your own.
I'm attempting to run this in a timer:
Application.Minimize;
ShowWindow( Application.handle, SW_HIDE );
It's been in the code forever and we just discovered that it doesn't work when you have a popupmenu active, it doesn't minimize the MDI parent window.
I figure if I can close the popup menu before running this code, then I'll be ok. Problem is, this code is in an MDI Parent and I have no idea where the current popup menu is. It doesn't matter if it's part of another form's tool bar, this forms tool bar, the product of a right click or that seemingly pointless key next to the space bar.
So, is there a way to hide the active popup menu in my entire program?
Also, if there's a better hunk of code than what I'm using to minimize that'll circumvent this issue, that'd be awesome info too.
To close a popup menu you can use
if GetCapture <> 0 then
SendMessage(GetCapture, WM_CANCELMODE, 0, 0);
in your code before you try to minimize the form.