Einzelnen Beitrag anzeigen

cetinbiryoldayim

Registriert seit: 6. Mai 2008
33 Beiträge
 
#16

Re: Bool-Array als Rückgabewert einer Funktion??

  Alt 29. Jun 2008, 17:09
ja ich weiss, hatte es verbessert und es ging

der aktuelle code folgt:

Delphi-Quellcode:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TBoolArray = Array of Boolean;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Button2: TButton;
    procedure Button2Click(Sender: TObject);
    procedure Button1Click(Sender: TObject);
  strict private
    neuesArray: TBoolArray;
  public
    function gibArray(): TBoolArray;
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
  neuesArray := gibArray();
end;

function TForm1.GibArray(): TBoolArray;
begin
  SetLength(Result, 3);
  Result[0] := True;
  Result[1] := True;
  Result[2] := True;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  if neuesArray[0] = true then
  begin
    showmessage('1t');
  end;

  if neuesArray[1] = false then
  begin
    showmessage('1f');
  end;

  if neuesArray[2] = true then
  begin
    showmessage('2t');
  end;
end;

end.


->> fehlerfrei
  Mit Zitat antworten Zitat