AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Wie nun InputQuery unter IOS nutzen?

Ein Thema von Harry Stahl · begonnen am 5. Mai 2022 · letzter Beitrag vom 6. Mai 2022
Antwort Antwort
Benutzerbild von Harry Stahl
Harry Stahl

Registriert seit: 2. Apr 2004
Ort: Bonn
2.479 Beiträge
 
Delphi 11 Alexandria
 
#1

Wie nun InputQuery unter IOS nutzen?

  Alt 5. Mai 2022, 21:53
Bis Delphi 10.3.3 und IOS 12.1 hat noch folgendes bei Klick auf einen Schalter funktioniert:

Delphi-Quellcode:
procedure Tfrm_fldverw.bnNewClick(Sender: TObject);
var
  NewString: String; P : Integer;
begin
  InputQuery ('Neue Bezeichnung anlegen...', ['Bitte geben Sie einen Text ein:'], [NewString],
    procedure (const AResult: TModalresult; const AValues: array of string)
    begin
      if AResult= mrOK then begin
        P := lbKat.Items.Add (AValues[0]);
        lbKat.ItemIndex := P;
      end;
    end);
end;
Nun soll man wohl Inputquerysync (oder Async) verwenden:

https://docwiki.embarcadero.com/Libr...InputQuerySync


Aber beides funktioniert hier nicht:

Die Async-Variante kommt immer mit result 0 2 (cancel) zurück.

Delphi-Quellcode:
procedure Tfrm_fldverw.bnNewClick(Sender: TObject);
var
  ASyncService : IFMXDialogServiceASync;
  caption, inData: array[0..0] of string;
  P: Integer;

  SyncService : IFMXDialogServiceSync;
  Acaption, AinData : array[0..0] of string;

begin
  caption[0] := 'Neue Bezeichnung :';
  inData[0] := '';

  // funktioniert nicht
  if TPlatformServices.Current.SupportsPlatformService (IFMXDialogServiceSync, IInterface(SyncService)) then
  begin
    if SyncService.InputQuerySync( 'Input String', caption, inData ) then begin
       P := lbKat.Items.Add (indata[0]);
       lbKat.ItemIndex := P;
    end;
  end;

  // das auch nicht, als Ergebnis kommt als result immer "2" zurück (cancel)
  if TPlatformServices.Current.SupportsPlatformService (IFMXDialogServiceAsync, IInterface (ASyncService)) then
  begin
    ASyncService.InputQueryAsync( 'Input String', caption, inData,
      procedure (const AResult : TModalResult; const AValues : array of string)
      var s: string;
      begin
         case AResult of
           mrOK: begin
             s := AValues[0];
             P := lbKat.Items.Add (AValues[0]);
             lbKat.ItemIndex := P;
           end;
         end;
      end );
  end;

(*
var
  NewString: String; P : Integer;
begin
  InputQuery ('Neue Bezeichnung anlegen...', ['Bitte geben Sie einen Text ein:'], [NewString],
    procedure (const AResult: TModalresult; const AValues: array of string)
    begin
      if AResult= mrOK then begin
        P := lbKat.Items.Add (AValues[0]);
        lbKat.ItemIndex := P;
      end;
    end);
*)

end;
Was mache ich falsch, wie geht es richtig?
  Mit Zitat antworten Zitat
Rollo62

Registriert seit: 15. Mär 2007
3.908 Beiträge
 
Delphi 12 Athens
 
#2

AW: Wie nun InputQuery unter IOS nutzen?

  Alt 6. Mai 2022, 10:57
Du brauchst doch eigentlich nur von der globalen Procedure auf die entsprechenden globalen class procedures umzustellen:

Delphi-Quellcode:
class procedure TDialogService.InputQuery(const ACaption: string; const APrompts: array of string; const AValues: array of string; const ACloseQueryProc: TInputCloseQueryProc);

...

FMX.DialogService.TDialogService
    {} .InputQuery( ACaption,
                    APrompts,
                    AValues,
                    LProcDlg );
  Mit Zitat antworten Zitat
Benutzerbild von Harry Stahl
Harry Stahl

Registriert seit: 2. Apr 2004
Ort: Bonn
2.479 Beiträge
 
Delphi 11 Alexandria
 
#3

AW: Wie nun InputQuery unter IOS nutzen?

  Alt 6. Mai 2022, 13:48
@Rollo62

Danke. Ich meine, ich hätte es so versucht - werde ich aber beim nächsten Programm noch mal so angehen (jetzt habe ich einfach eine eigene Form für die Texteingabe gemacht)....
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 07:44 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