Autor Beitrag
delvieh
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 46

WinXP, Win98
D4 Standard, D7 Personal
BeitragVerfasst: Mi 01.02.06 10:17 
Hallo,

ich möchte gerne an das Hauptformular einer Komponente X eine Message schicken, mit

ausblenden Delphi-Quelltext
1:
  Parent.Perform(WM_SYSCOMMAND,SC_DRAGMOVE,0);					


geht das nur wenn die Komponente nicht in einem anderem Panel liegt.
Hat man die Komponete aber in einem weiterem Panel abgelegt, so erhält das Panel diese Nachricht.

Kann man das Formular ähnlich wie "Parent" ausfindig machen, so das immer das Formular die Message erhält?


Gruß Frank...


Moderiert von user profile iconGausi: Topic aus Delphi Language (Object-Pascal) / CLX verschoben am Mi 01.02.2006 um 10:29
Tastaro
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 414
Erhaltene Danke: 23



BeitragVerfasst: Mi 01.02.06 10:29 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
var
   oParent: twincontrol;
   fForm: tform;
begin
   oParent := Self;
   fForm := nil;
   while assigned(oParent) and (not assigned(fForm)) do
   begin
      if oParent is tform then
         fForm := (oParent as tform);
      oParent := oParent.Parent;
   end;
   if assigned(fForm) then
      fForm.Perform(WM_SYSCOMMAND,SC_DRAGMOVE,0);
end;


Beste Grüße
Tastaro
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 481

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Mi 01.02.06 10:32 
Das sollte mit der Eigenschaft owner der Komponente gehen. Ansonsten mit einer Schleife sich von Parent zu Parent hangeln, bis man auf eine TForm stößt.

_________________
We are, we were and will not be.
delvieh Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 46

WinXP, Win98
D4 Standard, D7 Personal
BeitragVerfasst: Mi 01.02.06 12:50 
Mit Owner hat nicht ganz geklappt, das suchen nach dem Form ist super!
Danke! :D

Gruß Frank