Autor Beitrag
jjturbo
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 516

Win2000 prof., WinXP prof.
D4 Stand., D5 Prof, D7 Prof, D2007 Prof.
BeitragVerfasst: Di 24.10.06 12:48 
Moin Forum,

ich habe mir eine eigene Komponente von TPanel abgeleitet. Jetzt möchte ich, wenn diese neue Komponente (im Designmodus) auf das Formular gezogen oder in seiner Größe verändert wird darauf reagieren.

Kann mir jemand einen kleinen Anstoß geben, wie ich das realisieren kann?

Danke Euch
Gruß, jjturbo

_________________
Windows XP: Für die einen nur ein Betriebssystem - für die anderen der längste Virus der Welt...
_frank_
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 343
Erhaltene Danke: 1

Win XP
Delphi 3 Prof / Turbo Delphi Explorer
BeitragVerfasst: Di 24.10.06 18:01 
soll das nur zur designzeit oder auch zur Laufzeit sein?

prinzipiell gibt es TPanel ein event OnResize, welches von der Methode Resize gefeuert wird...

ausblenden Delphi-Quelltext
1:
2:
3:
4:
procedure TCustomPanel.Resize;
begin
  if Assigned(FOnResize) then FOnResize(Self);
end;


überschreibe die Methode einfach in deiner klasse (inherited nicht vergessen).

um auf Designmodus zu prüfen schau dir mal TComponent.ComponentState an ;)

Gruß Frank
jjturbo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 516

Win2000 prof., WinXP prof.
D4 Stand., D5 Prof, D7 Prof, D2007 Prof.
BeitragVerfasst: Mi 25.10.06 07:54 
Jepp, das wars, DANKE :-)

_________________
Windows XP: Für die einen nur ein Betriebssystem - für die anderen der längste Virus der Welt...
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Mi 25.10.06 16:21 
Auf die Erzeugung kannst Du durch Überschreiben von AfterConstruction und auf das entfernen in BeforeDestruction reagieren ...

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
jjturbo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 516

Win2000 prof., WinXP prof.
D4 Stand., D5 Prof, D7 Prof, D2007 Prof.
BeitragVerfasst: Do 26.10.06 10:32 
Ok, ich habe jetzt auch das Ereignis Onresize gut brauchen können, das funktioniert alles wunderbar.

Bekommt man zur Designzeit eigentlich auch irgendwie mit, daß die Komponente verschoben wurde?
Zu meiner erstellten Komponente wird eine andere sichtbare Komponente erzeugt, die ihre Position immer relativ zur ersten haben soll.
Bis jetzt korrigiere ich die Position immer per OnResize, d.h. aber, wenn die Komponente verschoben wird, so müßte ich erst einmal die Größe ändern, damit die zweite Komponente die korrekte Position einnimmt...

_________________
Windows XP: Für die einen nur ein Betriebssystem - für die anderen der längste Virus der Welt...
_frank_
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 343
Erhaltene Danke: 1

Win XP
Delphi 3 Prof / Turbo Delphi Explorer
BeitragVerfasst: Do 26.10.06 10:47 
onMove gibts imho nicht, du müsstest also die message selber abfangen (WM_MOVE,WM_ENDSIZEMOVE).

Gruß Frank