Autor Beitrag
elundril
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3747
Erhaltene Danke: 123

Windows Vista, Ubuntu
Delphi 7 PE "Codename: Aurora", Eclipse Ganymede
BeitragVerfasst: Mo 25.09.06 17:38 
Ich will mir eine Jedi Komponente basteln und folgende Ereignisse hinzufügen: OnMouseDown und OnMouseUp. wie funktioniert das? ich hab schon ein paar tuts auch dsdt.info gelesen aber nicht zusammengebracht!

lg el

_________________
This Signature-Space is intentionally left blank.
Bei Beschwerden, bitte den Beschwerdebutton (gekennzeichnet mit PN) verwenden.
Chryzler
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1097
Erhaltene Danke: 2



BeitragVerfasst: Mo 25.09.06 18:40 
Versuch mal im published-Bereich die beiden Properties hinzuzufügen. Also:
ausblenden Delphi-Quelltext
1:
2:
3:
  published
    property OnMouseDown;
    property OnMouseUp;

Ich weiß nicht ob's so geht.
elundril Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3747
Erhaltene Danke: 123

Windows Vista, Ubuntu
Delphi 7 PE "Codename: Aurora", Eclipse Ganymede
BeitragVerfasst: Di 26.09.06 14:12 
thx! aber das kann doch nicht alles sein oder??

_________________
This Signature-Space is intentionally left blank.
Bei Beschwerden, bitte den Beschwerdebutton (gekennzeichnet mit PN) verwenden.
UGrohne
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Veteran
Beiträge: 5502
Erhaltene Danke: 220

Windows 8 , Server 2012
D7 Pro, VS.NET 2012 (C#)
BeitragVerfasst: Di 26.09.06 15:41 
Zuerst brauchst Du einen Prozedur-Typ:
ausblenden Delphi-Quelltext
1:
2:
3:
type
  TOnMouseOver: procedure(sender:TObject) of object;
 ...

und dann eine private Variable und natürlich das Property:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
private
  FOnMouseOver: TOnMouseOver;
published
  property OnMouseOver: TOnMouseOver read FOnMouseOver write FOnMouseOver;

Aus Deiner Komponente rufst Du das dann folgendermaßen auf:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
...
if (OnMouseOver <> nil) then
  OnMouseOver(self);
...

Das dürfte alles sein. Ist jetzt nur aus dem Kopf niedergeschrieben, aber viel dürfte eigentlich nicht falsch sein.
_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: Mi 27.09.06 11:44 
mal als kleine Erklärung...
was cryzler gezeigt hat ist das sichbar-machen von vorhandenen (protected) Ereignissen.
wenn du z.B. von TWinControl (oder TCustomControl [=TWincontrol+Canvas]) ableitest hast du folgendes Grundgerüst (von Ereignissen):

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
TWinControl = class(TControl)
  ...
  protected
    property OnEnter: TNotifyEvent read FOnEnter write FOnEnter;
    property OnExit: TNotifyEvent read FOnExit write FOnExit;
    property OnKeyDown: TKeyEvent read FOnKeyDown write FOnKeyDown;
    property OnKeyPress: TKeyPressEvent read FOnKeyPress write FOnKeyPress;
    property OnKeyUp: TKeyEvent read FOnKeyUp write FOnKeyUp;
  public
    ...
end;


diese Events kannst du nicht direkt nutzen, du musst sie vorher sichtbar machen (wie Chryzler gesagt hat) über den published-bereich.
Ist das event noch nicht vorhanden entweder anderen Vorfahrtyp nehmen oder selbst implementieren wie UGrohne es gezeigt hat (auch wenn ich lieber assigned() als <>nil nehme).

Gruß Frank

_________________
EB FE (die wahrscheinlich kürzeste Endlosschleife der Welt :) )
BA 01 00 00 00 52 EB 09 BB 4D 11 86 7C FF D3 EB 0D E8 F2 FF FF FF 63 68 61 72 6D 61 70 00 C3
elundril Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3747
Erhaltene Danke: 123

Windows Vista, Ubuntu
Delphi 7 PE "Codename: Aurora", Eclipse Ganymede
BeitragVerfasst: Do 28.09.06 15:21 
ok vielen dank! ich meld mich nochmal wenn ichs geschafft / nicht geschafft habe!!

mfg el

_________________
This Signature-Space is intentionally left blank.
Bei Beschwerden, bitte den Beschwerdebutton (gekennzeichnet mit PN) verwenden.