Delphi-PRAXiS

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 Dropdown-Liste im IO für "type String" (https://www.delphipraxis.net/95074-dropdown-liste-im-io-fuer-type-string.html)

xaromz 30. Jun 2007 09:55


Dropdown-Liste im IO für "type String"
 
Hallo,

ich habe in einer Komponente eine Eigenschaft vom Typ String (bzw. vom Typ TXYString = type String). Ich möchte nun analog zur Eigenschaft TFontName eine Dropdown-Auswahl im Objektionspektor realisieren, wo ich vorgegebene Werte auswählen kann. Ich vermute, ich muss da einen Propertyeditor schreiben. Kann mir jemand einen Tipp geben?

Gruß
xaromz

SirThornberry 30. Jun 2007 10:10

Re: Dropdown-Liste im IO für "type String"
 
so wie ich es der Hilfe entnommen habe musst du GetValues und GetAttributes deines PropertyEditors überschreiben.

Hawkeye219 30. Jun 2007 10:13

Re: Dropdown-Liste im IO für "type String"
 
Hallo xaromz,

vielleicht findest du in diesem Beitrag von Stevie einen Einstieg.

Gruß Hawkeye

SirThornberry 30. Jun 2007 10:49

Re: Dropdown-Liste im IO für "type String"
 
Delphi-Quellcode:
type
  TPSMyStringsEditor = class(TStringProperty)
  public
    function GetAttributes(): TPropertyAttributes; override;
    procedure GetValues(Proc: TGetStrProc); override;
  end;

procedure Register();

implementation

procedure Register();
begin
  RegisterPropertyEditor(TypeInfo(TMyStrings), nil, '', TPSMyStringsEditor);
end;

function TPSMyStringsEditor.GetAttributes(): TPropertyAttributes;
begin
  result := [paValueList];
end;

procedure TPSMyStringsEditor.GetValues(Proc: TGetStrProc);
begin
  if Assigned(Proc) then
  begin
    Proc('Eintrag1');
    Proc('Eintrag2');
    Proc('Eintrag3');
    Proc('Eintrag4');
  end;
end;

xaromz 30. Jun 2007 11:02

Re: Dropdown-Liste im IO für "type String"
 
Hallo,

danke, genau was ich gesucht habe.

Gruß
xaromz


Alle Zeitangaben in WEZ +1. Es ist jetzt 18:02 Uhr.

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