Кому интересно, вот ссылка с примерами со всеми deprecated диалогами и InputBox'ами: http://c2design5sh.blogspot.ru
unit Unit1;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.ListBox, FMX.Layouts,
FMX.Platform, FMX.StdCtrls, FMX.Controls.Presentation, FMX.DialogService, FMX.ScrollBox, FMX.Memo;
type
TForm1 = class(TForm)
ToolBar1: TToolBar;
Label1: TLabel;
ListBox1: TListBox;
ListBoxItem1: TListBoxItem;
ListBoxItem2: TListBoxItem;
ListBoxItem3: TListBoxItem;
ListBoxItem4: TListBoxItem;
ListBoxItem5: TListBoxItem;
ListBoxItem6: TListBoxItem;
Memo1: TMemo;
procedure ListBoxItem1Click(Sender: TObject);
procedure ListBoxItem2Click(Sender: TObject);
procedure ListBoxItem3Click(Sender: TObject);
procedure ListBoxItem4Click(Sender: TObject);
procedure ListBoxItem5Click(Sender: TObject);
procedure ListBoxItem6Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.fmx}
// uses FMX.Platform, FMX.DialogService
//**************************************************************************************************
procedure TForm1.ListBoxItem1Click(Sender: TObject);
var
ASyncService : IFMXDialogServiceASync;
begin
if TPlatformServices.Current.SupportsPlatformService (IFMXDialogServiceAsync, IInterface (ASyncService)) then
begin
ASyncService.ShowMessageAsync ( ( Sender as TListBoxItem ).Text );
end;
Memo1.Lines.Clear;
Memo1.Lines.Add( 'ShowMessageAsync Displayed' );
end;
procedure TForm1.ListBoxItem2Click(Sender: TObject);
var
SyncService : IFMXDialogServiceSync;
begin
if TPlatformServices.Current.SupportsPlatformService (IFMXDialogServiceAsync, IInterface (SyncService)) then
begin
SyncService.ShowMessageSync ( ( Sender as TListBoxItem ).Text );
end;
Memo1.Lines.Clear;
Memo1.Lines.Add( 'ShowMessageSync Displayed' );
end;
//**************************************************************************************************
procedure TForm1.ListBoxItem3Click(Sender: TObject);
var
ASyncService : IFMXDialogServiceASync;
caption, inData : array[0..1] of string;
begin
caption[0] := 'ID :';
caption[1] := #1 + 'Pass :'; // #1 앞에 붙이면 마스킹 기능
inData[0] := 'admin'; // 초기값
inData[1] := '1234';
if TPlatformServices.Current.SupportsPlatformService (IFMXDialogServiceAsync, IInterface (ASyncService)) then
begin
ASyncService.InputQueryAsync( 'Input String', caption, inData,
procedure (const AResult : TModalResult; const AValues : array of string)
begin
case AResult of
mrOk: ( Sender as TListBoxItem ).Text := AValues[0] + '/' + AValues[1];
end;
end );
end;
Memo1.Lines.Clear;
Memo1.Lines.Add( 'InputQueryAsync Displayed' );
end;
procedure TForm1.ListBoxItem4Click(Sender: TObject);
var
SyncService : IFMXDialogServiceSync;
caption, inData : array[0..1] of string;
begin
caption[0] := 'ID :';
caption[1] := #1 + 'Pass :'; // #1 앞에 붙이면 마스킹 기능
inData[0] := 'admin'; // 초기값
inData[1] := '1234';
if TPlatformServices.Current.SupportsPlatformService (IFMXDialogServiceSync, IInterface(SyncService)) then
begin
if SyncService.InputQuerySync( 'Input String', caption, inData ) then
( Sender as TListBoxItem ).Text := inData[0] + '/' + inData[1];
end;
Memo1.Lines.Clear;
Memo1.Lines.Add( 'InputQuerySync Displayed' );
end;
//**************************************************************************************************
procedure TForm1.ListBoxItem5Click(Sender: TObject);
var
ASyncService : IFMXDialogServiceASync;
begin
if TPlatformServices.Current.SupportsPlatformService (IFMXDialogServiceAsync, IInterface(ASyncService)) then
begin
ASyncService.MessageDialogAsync( 'Question ?', TMsgDlgType.mtConfirmation,
[TMsgDlgBtn.mbYes, TMsgDlgBtn.mbNo], TMsgDlgBtn.mbNo, 0,
procedure(const AResult: TModalResult)
begin
case AResult of
mrYES : ( Sender as TListBoxItem ).Text := 'YES';
end;
end);
end;
Memo1.Lines.Clear;
Memo1.Lines.Add( 'MessageDialogAsync Displayed' );
end;
procedure TForm1.ListBoxItem6Click(Sender: TObject);
var
SyncService : IFMXDialogServiceSync;
rValue, i : integer;
begin
if TPlatformServices.Current.SupportsPlatformService (IFMXDialogServiceSync, IInterface(SyncService)) then
begin
rValue := SyncService.MessageDialogSync( 'Question ?', TMsgDlgType.mtConfirmation,
[TMsgDlgBtn.mbYes, TMsgDlgBtn.mbNo], TMsgDlgBtn.mbNo, 0 );
( Sender as TListBoxItem ).Text := rValue.ToString;
end;
Memo1.Lines.Clear;
Memo1.Lines.Add( 'MessageDialogSync Displayed' );
end;
end.