Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   Delphi TPopupMenu will nicht verschwinden (https://www.delphipraxis.net/19522-tpopupmenu-will-nicht-verschwinden.html)

phlux 5. Apr 2004 01:34


TPopupMenu will nicht verschwinden
 
Sers! :hi:
Also folgendes Problem hab ne TrayIcon Kompo, jetz lass ich im Rechtemaustaste Event der TrayIcon Kompo mit
Delphi-Quellcode:
  PopUpMenu.Popup(Mouse.CursorPos.X, Mouse.CursorPos.Y);
das PopupMenu aufpoppen. Wenn ich jetzt allerdings irgendwo willkürlich auf dem Desktop hinklicke erwartet man ja das sich das Popupmenu von alleine schließt. Macht es aber nicht :kotz:

Weiß jemand Rat wie man das beseitigen kann?

mfg phlux :hi:

Tryer 5. Apr 2004 01:56

Re: TPopupMenu will nicht verschwinden
 
Schau mal nach SetCapture() und ReleaseCapture()

MfG,
Tryer :coder:

Luckie 5. Apr 2004 02:33

Re: TPopupMenu will nicht verschwinden
 
Nope. Das ist es nicht.

Code:
procedure TForm1.WndProc(var Msg: TMessage);
var
  Point: TPoint;
begin
  if Msg.Msg = WM_USER + 20 then
  begin
    case Msg.lParam of
      WM_RBUTTONDOWN:
        begin
          [color=red]SetForegroundWindow(Handle);[/color]
          GetCursorPos(Point);
          PopUpMenu1.PopUp(Point.X, Point.Y);
        end;
      WM_LBUTTONDOWN:
        begin
          //ShowMessage('links runter');
        end;
      WM_LBUTTONDBLCLK:
        begin
          Form1.Show;
          // Icon nur anzeigen wenn Fenster minimiert
          Shell_NotifyIcon(NIM_DELETE, @IconData);
        end;
    end;
  end;
  inherited;
end;
Die rote Zeile, ist die entscheidenden. ;)

phlux 5. Apr 2004 09:58

Re: TPopupMenu will nicht verschwinden
 
Dankeee Luckie :) jetzt verschwindet es auch so wie es sollte :hello:

Thx euch beiden!

mfg phlux :hi:


Alle Zeitangaben in WEZ +1. Es ist jetzt 08:41 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz