Einzelnen Beitrag anzeigen

WebUpdate System

Registriert seit: 11. Aug 2009
19 Beiträge
 
#41

Re: Manifest-Creator

  Alt 5. Sep 2009, 10:31
Hallo Himitsu,

wenn man eine .Ini erneut läd, kommt es zu einer Exception, "List index out of bounds (xxx)"

Delphi-Quellcode:
Procedure TForm1.Button2Click(Sender: TObject);
    Var F: TIniFile;
      i, i2: Integer;
      C: TWinControl;

    Begin
      OpenDialog1.DefaultExt := 'ini';
      OpenDialog1.FileName := Edit3.Text;
      OpenDialog1.Filter := SIniFile;
      OpenDialog1.FilterIndex := 1;
      If not Assigned(Sender) or OpenDialog1.Execute Then Begin
        F := TIniFile.Create(OpenDialog1.FileName);
        Try
          For i := 0 to ComponentCount - 1 do Begin
            C := TwinControl(Components[i]);
            If (GetShortHint(C.Hint) <> '') and (Copy(GetShortHint(C.Hint), 1, 1) <> '*') Then
              If C is TCustomComboBox Then Begin
                If TComboBox(C).Style = csDropDownList Then
                  TComboBox(C).ItemIndex := F.ReadInteger('ManifestCreator', GetShortHint(C.Hint), 0)
                Else TComboBox(C).Text := F.ReadString('ManifestCreator', GetShortHint(C.Hint), '');
              End Else If C is TCheckListBox Then Begin
                For i2 := 0 to TCheckListBox(C).Items.Count - 1 do
                  TCheckListBox(C).Checked[i2] := F.ReadBool('ManifestCreator', //<<< HIER kommt der ERROR
                    GetShortHint(C.Hint) + '_' + TCheckListBox(C).Items[i], False);
              End Else If C is TCustomCheckBox Then
                TCheckBox(C).Checked := F.ReadBool('ManifestCreator', GetShortHint(C.Hint), False)
              Else If C is TCustomEdit Then
                TEdit(C).Text := F.ReadString('ManifestCreator', GetShortHint(C.Hint), '');
          End;
        Finally
          F.Free;
        End;
      End;
    End;
Kannst Du dir das mal ansehen?
  Mit Zitat antworten Zitat