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 Combobox mit Treeview, ALT+TAB und Co. (https://www.delphipraxis.net/138896-combobox-mit-treeview-alt-tab-und-co.html)

Alaitoc 19. Aug 2009 15:24


Combobox mit Treeview, ALT+TAB und Co.
 
Hallo DP-Community,

Ich habe eine Komponente bestehend aus:
  • - Panel als Rahmen und Hintergrund
  • - Editfeld zur Eingabe
  • - Speedbutton als DropDown-Button
  • - Form als Fenster für den Treeview
  • - Treeview zur Auswahl der Knoten

Ich rufe also per DropDown-Button das Formular auf:
  • Parent auf den Desktop setzen. Windows.SetParent(Formular.Handle, GetDesktopWindow);
  • Anzeigen. Formular.Show();
  • Nach Vorne bringen. Formular.BringToFront();

Da ich per SetWindowLong() eingestellt habe das es keinen Fokus kriegt, da der ja wie bei einer normalen Combobox auf dem Hauptformular liegen soll, habe ich nun versucht mit SetCapture,MouseUP,MouseDOWN,KeyPress,KeyUP,Keydow n mein Formular wieder zu schließen.

SetWindowLong():
Delphi-Quellcode:
// Entfernt den Taskleisten-Eintrag
SetWindowLong(Formular.Handle,GWL_EXSTYLE,(GetWindowLong(Formular.Handle, GWL_EXSTYLE) or WS_EX_TOOLWINDOW ));
// Entfernt den 3D-Rahmen
SetWindowLong(Formular.Handle,GWL_EXSTYLE,(GetWindowLong(Formular.Handle, GWL_EXSTYLE) or WS_EX_STATICEDGE ));
// Entfernt die Titelleiste
SetWindowLong(Formular.Handle,GWL_STYLE ,(GetWindowLong(Formular.Handle, GWL_STYLE) and not WS_Caption));
Nur stehe ich nun bei der Problematik das ich keine Ahnung habe wie ich ALT+TAB, STRG+ALT+DEL und Co. abfragen kann...
Hat jemand eine Idee? Oder weiß vielleicht jemand wie ich bei dem Editfeld einfach fragen würde wenn es nicht gerade aktiv ausgewählt ist (also auch wenn die Anwendung / Formular nicht ausgewählt ist)?

Hoffe das mir jemand helfen kann...laufe nämlich zur Zeit von einer Mauer zur Nächsten und komme eher mühsam weiter...

MfG Alaitoc

Alaitoc 19. Aug 2009 16:37

Re: Combobox mit Treeview, ALT+TAB und Co.
 
Grausam wenn man stundenlang sucht...es ins Forum stellt und es dann mit ein paar Codezeilen behebt :wall:

Delphi-Quellcode:
type
  TFocusLostEvent = procedure (Sender:TObject) of Object;

Type
  TFocusEdit = class (TEdit)
  Private
    m_pmfnFocusLost :TFocusLostEvent;
    procedure WMKillFocus(var Message: TWMKillFocus); message WM_KILLFOCUS;
  Public
    property OnFocusLost:TFocusLostEvent read m_pmfnFocusLost write m_pmfnFocusLost;
  End;

---

{ TFocusEdit }

procedure TFocusEdit.WMKillFocus(var Message: TWMKillFocus);
begin
  inherited;
  if Assigned(m_pmfnFocusLost) then
  begin
   OnFocusLost(Self);
  end;
end;
Und dabei war es so simpel ;_;


Alle Zeitangaben in WEZ +1. Es ist jetzt 14:11 Uhr.

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