Thema: Delphi Array of Boolean Problem

Einzelnen Beitrag anzeigen

delphinub23

Registriert seit: 27. Okt 2010
Ort: Chemnitz
110 Beiträge
 
Delphi XE3 Professional
 
#6

AW: Array of Boolean Problem

  Alt 22. Aug 2011, 12:16
Deklaration:
Delphi-Quellcode:
type
  TMyBoolArray = array[11..18] of Boolean;

type
  THandler = class(TObject)
  private
    FMyBoolArray: TMyBoolArray;
  public
    procedure SetPosition(const APos: Integer);
  end;
Hier kommt die AV:
Delphi-Quellcode:
procedure THandler.SetPosition(const APos: Integer);
begin
  if (APos>= 11) and (APos<= 18) then
    FMyBoolArray[APos] := TRUE;
end;
Aufruf:
Delphi-Quellcode:
procedure TMyForm.chBoxClick(Sender: TObject);
var
  CtrlIntCap: Integer;
  MyHandler: THandler;
begin
  if Sender is TCheckBox then
  begin
    CtrlIntCap := StrToInt(TCheckBox(Sender).Caption);

    if (CtrlIntCap <= 18) and (CtrlIntCap >= 11) then
      MyHandler.SetPosition(CtrlIntCap);
  end;
end;

Zitat:
Ist die Instanz von THandler überhaupt "ordentlich" erstellt worden?
ähhmm...nö.
  Mit Zitat antworten Zitat