Delphi-PRAXiS
Seite 1 von 3  1 23      

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   Delphi Unterproperty in Objektinstpektor (https://www.delphipraxis.net/8314-unterproperty-objektinstpektor.html)

Taladan 2. Sep 2003 11:26


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?

Leuselator 2. Sep 2003 11:49

Re: Unterproperty in Objektinstpektor
 
z.B.:

Delphi-Quellcode:
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;
oder:

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ß

Nimoee 2. Sep 2003 17:18

Re: Unterproperty in Objektinstpektor
 
Hallo,

wenn das Ganze jetzt auch noch eine Antwort auf die Frage wäre, wäre alles O.K.

nimoee

Motzi 2. Sep 2003 17:23

Re: Unterproperty in Objektinstpektor
 
Wieso? Er hat doch ein Beispiel mit dem nötigen Code geliefert... was brauchst du mehr?

Nimoee 2. Sep 2003 17:26

Re: Unterproperty in Objektinstpektor
 
hallo,

die Antwort ist unvollständig und funktioniert nicht!

nimoee

Nimoee 2. Sep 2003 17:33

Re: Unterproperty in Objektinstpektor
 
hallo,

hier wurde eine Arry Eigenschaft definiert und erklärt. Gefragt war aber nach untergeordneten Properties.

nimoee

Phoenix 2. Sep 2003 17:36

Re: Unterproperty in Objektinstpektor
 
Sofern ein Property ein Objekt ist, welches wiederum published Propertys hat, werden diese automatisch im Objekt-Inspektor angezeigt.

Nimoee 2. Sep 2003 17:40

Re: Unterproperty in Objektinstpektor
 
er hat aber gefragt , wie man Unterproperties erstellt. Mit dem + Zeichen davor. So geht das auf jeden Fall nicht!

nimoee

Motzi 2. Sep 2003 17:48

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...

Nimoee 2. Sep 2003 17:53

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 11:57 Uhr.
Seite 1 von 3  1 23      

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz