Einzelnen Beitrag anzeigen

GS1200

Registriert seit: 16. Jul 2006
26 Beiträge
 
#4

AW: XE6 ModalesFenster mrResult bringt Fehler.

  Alt 7. Jun 2014, 15:09
Ich habe es gefunden...

Im Beispiel steht es so:
Delphi-Quellcode:
 procedure THeaderFooterForm.btnPickClick(Sender: TObject); var
  dlg: TForm1;
begin
  dlg := TForm1.Create(nil);
  // select current value, if available in the list
  dlg.ListBox1.ItemIndex := dlg.ListBox1.Items.IndexOf(edit1.Text);
 
  dlg.ShowModal(procedure(ModalResult: TModalResult)
    begin
      if ModalResult = mrOK then
      // if OK was pressed and an item is selected, pick it
        if dlg.ListBox1.ItemIndex >= 0 then
          edit1.Text := dlg.ListBox1.Items [dlg.ListBox1.ItemIndex];
      dlg.DisposeOf;
    end);
 
end;
die Zeile dlg.DisposeOf habe ich durch freeandnil(dlg) ersetzt und dann geht es.

Gruß

Axel
  Mit Zitat antworten Zitat