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 systray application without any taskbar icon. Nowdays most systray icons are hidden and I want to make an easier access to app.
There are no forms created with Application.FormCreate so Delphi cannot show icon itself.
How to show a normal app icon always on taskbar even when there is no visible form available?
I want to catch the click like this and when its clicked show the GUI with my custom function:
class procedure TTrayMain.HandleMessages(var Msg: TMsg; var Handled: Boolean);
begin
if (Msg.wparam = SC_RESTORE ) then begin
MenuPopup (popup,2);
Exit;
end;
A Taskbar button cannot exist without a window to represent. There are only 3 ways for a Taskbar button to be created:
create a visible window with the WS_EX_APPWINDOW style
create a visible top-level unowned window
use ITaskbarList::AddTab()
All of them require a window. But, that doesn't mean the user has to see the window. You can create a visible window with width/height set to 0 (some frameworks do this so no single app window owns the Taskbar button, but the button can show/hide the entire app as a whole), or move it offscreen. And then the window can respond to state changes as need, such as via the Taskbar button.
Otherwise, since your tray app likely has a hidden window to receive icon notifications, you can try using that window with ITaskbarList. I just don't know if it will actually do anything meaningful when the user clicks on the button. So, consider changing your tray app to use a visible but unseen window for notifications, then it can have a Taskbar button without involving ITaskbarList.
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?
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.
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.