Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Cross-Platform-Entwicklung (https://www.delphipraxis.net/91-cross-platform-entwicklung/)
-   -   XE6 ModalesFenster mrResult bringt Fehler. (https://www.delphipraxis.net/180679-xe6-modalesfenster-mrresult-bringt-fehler.html)

GS1200 7. Jun 2014 12:17

XE6 ModalesFenster mrResult bringt Fehler.
 
Liste der Anhänge anzeigen (Anzahl: 1)
Hallo zusammen,

bei meinem Projekt bekomme ich bei der Verwendung eines Modalen Fensters einen Fehler, wenn ich ein mrResult zurück geben. Ein kleines Testprojekt anbei, kann jemand den Fehler auch nachstellen? Ist es ein Bug in XE6?

Gruß

Axel

Anhang 41307

Daniel 7. Jun 2014 12:21

AW: XE6 ModalesFenster mrResult bringt Fehler.
 
Für welche Plattform?
Auf den mobilen Plattformen ist es mit modalen Fenstern etwas schwierig. Unter iOS wird "ShowModal()" mit Hängen und Würgen unterstützt, unter Android gibt es einen Fehler. Windows und MacOS hingegen sollten funktionieren.

GS1200 7. Jun 2014 12:25

AW: XE6 ModalesFenster mrResult bringt Fehler.
 
Sorry, hatte ich nicht erwähnt.. für Android.

Ich habe mich am Beispiel von emarcadero gehalten:

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;
Hier der Artikel LINK

Gruß

Axel

GS1200 7. Jun 2014 15:09

AW: XE6 ModalesFenster mrResult bringt Fehler.
 
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. :roll:

Gruß

Axel

Sir Rufo 7. Jun 2014 15:31

AW: XE6 ModalesFenster mrResult bringt Fehler.
 
Und da du für Android programmierst sollte auch
Delphi-Quellcode:
dlg := nil;
ausreichen.


Alle Zeitangaben in WEZ +1. Es ist jetzt 19:24 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz