![]() |
Unterproperty in Objektinstpektor
Wie man eine Standartproperty im Objektinspektor anlegt, hab ich bereits herausgefunden. Doch wie mach ich das, wenn ich ich wie, z. b. bei einen Label Anchors als einen Properte und durch das + Zeichen alle unterpropertys anzeigen lassen möchte?
|
Re: Unterproperty in Objektinstpektor
z.B.:
Delphi-Quellcode:
oder:
type
TMyComponent = class(TWinControl) private FVisible, FStayOnTop, FPopUp, FFlashing : Boolean; protected procedure SetValue(index : Integer; Value : Boolean); public published property Visible : Boolean index 0 read FVisible write SetValue; property StayOnTop : Boolean index 1 read FStayOnTop write SetValue; property PopUp : Boolean index 2 read FPopUp write SetValue; property Flashing : Boolean index 3 read FFlashing write SetValue; end; implementation procedure TMyComponent.SetValue(index : Integer; Value : Boolean); begin case index of 0: FVisible := Value; 1: FStayOnTop := Value; 2: FPopUp := Value; 3: FFlashing := Value; end; end;
Delphi-Quellcode:
type
TShowMode = (smVisible,smStayOnTop,smPopUp,smFlashing); TShowModeSet = set of TShowMode; TMyComponent = class(TWinControl) private FShowMode : TShowModeSet; FVisible, FStayOnTop, FPopUp, FFlashing : Boolean; protected procedure SetValue(Value : TShowModeSet); public property Visible : Boolean read FVisible ; property StayOnTop : Boolean read FStayOnTop; property PopUp : Boolean read FPopUp ; property Flashing : Boolean read FFlashing ; published property ShowMode : TShowModeSet read FShowMode write SetValue; end; implementation procedure TMyComponent.SetValue(Value: TShowModeSet); begin FShowMode := Value; FStayOnTop := (smVisible in FShowMode); FFlash := (smStayOnTop in FShowMode); FPopUp := (smPopUp in FShowMode); FFlashing := (smFlashing in FShowMode); end; Gruß |
Re: Unterproperty in Objektinstpektor
Hallo,
wenn das Ganze jetzt auch noch eine Antwort auf die Frage wäre, wäre alles O.K. nimoee |
Re: Unterproperty in Objektinstpektor
Wieso? Er hat doch ein Beispiel mit dem nötigen Code geliefert... was brauchst du mehr?
|
Re: Unterproperty in Objektinstpektor
hallo,
die Antwort ist unvollständig und funktioniert nicht! nimoee |
Re: Unterproperty in Objektinstpektor
hallo,
hier wurde eine Arry Eigenschaft definiert und erklärt. Gefragt war aber nach untergeordneten Properties. nimoee |
Re: Unterproperty in Objektinstpektor
Sofern ein Property ein Objekt ist, welches wiederum published Propertys hat, werden diese automatisch im Objekt-Inspektor angezeigt.
|
Re: Unterproperty in Objektinstpektor
er hat aber gefragt , wie man Unterproperties erstellt. Mit dem + Zeichen davor. So geht das auf jeden Fall nicht!
nimoee |
Re: Unterproperty in Objektinstpektor
Es gibt 2 Möglichkeiten solche Properties zu erstellen! Entweder mit einem Enumerations-Typ (zB. Anchors) oder aber eine Instanz eines Nachfolgers von TPersistent als published property!
Im ersten Fall bekommst du eine Auflistung aller Elemente der Enumeration als Boolean-Einträge die festlegen ob das Element in der Enumeration vorkommt oder nicht, im 2ten Fall kannst du im TPersistent-Nachfolger ganz normal alle möglichen Properties einführen die im OI dann eben als "Untereigenschaft" auftauchen - das ganze kann beliebig geschachtelt werden... |
Re: Unterproperty in Objektinstpektor
hallo,
sei bitte so freundlich und erklär das am 1. Beispiel! nimoee |
Alle Zeitangaben in WEZ +1. Es ist jetzt 09:59 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