![]() |
Ereignis zu TJvLED hinzufügen
Hallo und frohe Weihnachten,
also ich habe mit Komponentenprogrammierung noch so gut wie keine Erfahrung. Nun will ich von der Komponente TJvLED (eine Jedi Kompo) eine Komponente ableiten, die zusätzlich das Ereignis OnColorChange (also wenn die Farbe geändert wird) besitzt. Dazu erstmal den Code von TJvLED
Delphi-Quellcode:
Dann habe ich:
TJvCustomLED = class(TJvGraphicControl)
private FImgPict: TBitmap; FImgMask: TBitmap; FTimer: TTimer; FColorOn: TColor; FColorOff: TColor; FActive: Boolean; FStatus: Boolean; FOnChange: TNotifyEvent; {$IFDEF VisualCLX} FAutoSize: Boolean; procedure SetAutoSize(Value: Boolean); {$ENDIF VisualCLX} procedure SetColorOn(Value: TColor); procedure SetColorOff(Value: TColor); procedure SetInterval(Value: Cardinal); function GetInterval: Cardinal; procedure SetActive(Value: Boolean); function GetActive: Boolean; procedure SetStatus(Value: Boolean); function GetStatus: Boolean; procedure DoBlink(Sender: TObject); protected procedure ColorChanged; override; procedure Paint; override; property Active: Boolean read GetActive write SetActive default False; property Color default clLime; property ColorOn: TColor read FColorOn write SetColorOn default clLime; property ColorOff: TColor read FColorOff write SetColorOff default clRed; property Interval: Cardinal read GetInterval write SetInterval default 1000; property Status: Boolean read GetStatus write SetStatus default True; {$IFDEF VisualCLX} property AutoSize: Boolean read FAutoSize write SetAutoSize; {$ENDIF VisualCLX} public constructor Create(AOwner: TComponent); override; destructor Destroy; override; procedure SetBounds(ALeft, ATop, AWidth, AHeight: Integer); override; end; TJvLED = class(TJvCustomLED) published property Active; property Align; property Anchors; property AutoSize; {$IFDEF VCL} property DragCursor; property DragKind; property OnEndDock; property OnStartDock; {$ENDIF VCL} property ColorOn; property ColorOff; property Constraints; property DragMode; property Height default 17; property Interval; property ParentShowHint; property PopupMenu; property ShowHint; property Status; property Visible; property Width default 17; property OnClick; property OnContextPopup; property OnDblClick; property OnDragDrop; property OnDragOver; property OnEndDrag; property OnMouseDown; property OnMouseMove; property OnMouseUp; property OnStartDrag; end;
Delphi-Quellcode:
und
TALED=class(TJVLED)
private FOnColorChange:TNotifyEvent; protected procedure ColorChanged; published property OnColorChange:TNotifyEvent read FOnColorChange write FOnColorChange; end;
Delphi-Quellcode:
doch es wird kein Ereignis ausgelöst.
procedure TALED.ColorChanged;
begin inherited ColorChanged; if Assigned(FOnColorChange) then FOnColorChange(self); end; Habe ich die falsche Procedure zum auslösen des Ereignisses gewählt? Wo wird dann die Farbe geändert? Hoffe ihr könnt mir helfen. MFG und frohe Feiertage Alexander |
Re: Ereignis zu TJvLED hinzufügen
Zitat:
|
Re: Ereignis zu TJvLED hinzufügen
Genial. Das klappt sogar!!!
Mega vielen Dank. Gruß Alexander |
Alle Zeitangaben in WEZ +1. Es ist jetzt 05: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-2025 by Thomas Breitkreuz