Jump to content
taariq

Syntax error in From clause

Recommended Posts

Guest

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private

    //TInputCloseQueryEvent = procedure (Sender: TObject; const Values: array of string; var CanClose: Boolean) of object;
    procedure MyInputCloseQueryEvent(Sender: TObject; const Values: array of string; var CanClose: boolean);
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.MyInputCloseQueryEvent(Sender: TObject; const Values: array of string; var CanClose: boolean);
begin
  if not(Sender = nil) then
    ShowMessage('Sender is a: ' + Sender.ClassName);
  //
  // what do with this values?
  for var MyItem in Values do
    ShowMessage('MyItem = ' + MyItem);
  //
  CanClose := true; // yes or not?
end;

procedure TForm1.Button1Click(Sender: TObject);
var
  MyPrompts  : TArray<string>;
  MyValues: TArray<string>;
begin
  MyPrompts   := ['p1', 'p2', 'p3'];
  MyValues := ['q1', 'q2', 'q3'];

  // InputBox('caption', 'prompt', 'default value') use "InputQuery() behind scenes.
  if InputQuery('Caption', MyPrompts, MyValues, MyInputCloseQueryEvent { or nil } , Self { TForm1... or nil } ) then
    ShowMessage('What to do now?');
end;

Edited by Guest

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×