Einzelnen Beitrag anzeigen

Benutzerbild von Alexander Roth
Alexander Roth

Registriert seit: 17. Mai 2004
Ort: Kenn
574 Beiträge
 
Turbo Delphi für Win32
 
#7

Re: TStringlist als Property - Werte nicht in Laufzeit übern

  Alt 10. Aug 2007, 15:13
Ok:
Alle wäre ein bisschen zuviel, deswegen:


Delphi-Quellcode:
  TExpandPanels = class(TWinControl)
  private
    { Private-Deklarationen }

    PanelArray:TClassArray;

    // Properties
    FCountPanels:integer;
    FColors:TJvRollOutColors;
    FBehaviour:TExpandPanelsBehaviour;
    FCaptions,
    FExpandList,
    FHeightList:TStringList;
    procedure setCountPanels(value:Integer);
    procedure setColors(value:TJvRollOutColors);
    procedure setBehaviour(value:TExpandPanelsBehaviour);
    procedure setCaptions(value:TStringList);
    procedure setExpandList(value:TStringList);
    procedure setHeightList(value:TStringList);


    procedure JvRollOutClick(Sender: TObject);
    procedure ArrangePanels(WhatResize:TWhatResize);
    procedure HotTrackSetActivePanel(value:integer);
    procedure AddPanel;

    procedure CopyColorsTo(AimColors:TJvRollOutColors);

    procedure JvRollOut1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
  protected
    { Protected-Deklarationen }
  public
    { Public-Deklarationen }
  published
    { Published-Deklarationen }
    property CountPanels:integer read FCountPanels write setCountPanels;
    property Colors:TJvRollOutColors read FColors write setColors;
    property Behaviour:TExpandPanelsBehaviour read FBehaviour write setBehaviour;
    property Captions:TStringList read FCaptions;
    property ExpandList:TStringList read FExpandList;
    property HeightList:TStringList read FHeightList;

    constructor create(AOwner: TComponent); override;
    destructor destroy; override;
  end;



Delphi-Quellcode:
constructor TExpandPanels.create(AOwner: TComponent);
begin
  inherited create(AOwner);

  FCaptions:=TStringList.Create;
  FExpandList:=TStringList.Create;
  FHeightList:=TStringList.Create;
  FColors:=TJvRollOutColors.Create;
  PanelArray:=TClassArray.create(false);

  Self.Height:=300;
  Self.Width:=150;
  FColors.ButtonColor:=clBlue;
  FColors.HotTrackText:=clRed;

  CountPanels:=3;
end;
Delphi-Quellcode:
destructor TExpandPanels.destroy;
begin
  FCaptions.Free;
  FCaptions:=nil;
  FExpandList.Free;
  FExpandList:=nil;
  FHeightList.Free;
  FHeightList:=nil;
  FColors.Free;
  FColors:=nil;

  PanelArray.Free;
  PanelArray:=nil;

  inherited destroy;
end;
Delphi-Quellcode:
procedure TExpandPanels.setCaptions(value:TStringList);
var i:Integer;
begin
  FCaptions.Assign(value);

  for I := 0 to PanelArray.Count - 1 do
    if value.Count>=PanelArray.count then
      PanelArray[i].Caption:=value[i]
    else
      Continue;
end;




procedure TExpandPanels.setExpandList(value:TStringList);
var i:Integer;
begin
  FExpandList.Assign(value);

  for I := 0 to PanelArray.Count - 1 do
    if value.Count>=PanelArray.count then
      PanelArray[i].Collapsed:= pos('0',value[i])>0
    else
      Continue;

  ArrangePanels(WRRoot);
end;


procedure TExpandPanels.setHeightList(value:TStringList);
var i:Integer;
begin
  FHeightList.Assign(value);

  for I := 0 to PanelArray.Count - 1 do
    if value.Count>=PanelArray.count then
      PanelArray[i].Height:=strtoint(value[i])
    else
      Continue;

  ArrangePanels(WRRoot);
end;
So es ist allerdings egal, ob ich in den set... nur
  FHeightList.Assign(value); oder den anderen kram noch stehen habe.
Der Fehler bleibt!
Alexander Roth
Ich bin umgestiegen auf: Lazarus und Ubuntu! Alles OpenSource!

Besuch doch mal: www.roth.us.ms
  Mit Zitat antworten Zitat