Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
const
UserMessage = 'Reply Yes or No';
var
dlg: TForm;
...
...
...
dlg := CreateMessageDialog(UserMessage, mtConfirmation, [mbYes,mbNo] );
dlg.Visible := true;
...
...
...
...
dlg.Free;
dlg: TForm;
procedure YesClick(Sender: TObject);
procedure NoClick(Sender: TObject);
procedure TForm1.Button1Click(Sender: TObject);
var
c: integer;
const
UserMessage = 'Reply Yes or No';
begin
dlg := CreateMessageDialog(UserMessage, mtConfirmation, [mbYes,mbNo] );
for c := 0 to dlg.ComponentCount - 1 do
if dlg.Components[c].Name = 'Yes' then
(dlg.Components[c] as TButton).OnClick := YesClick
else if dlg.Components[c].Name = 'No' then
(dlg.Components[c] as TButton).OnClick := NoClick;
dlg.Visible := true;
end;
procedure TForm1.YesClick(Sender: TObject);
begin
ShowMessage ( 'Yes clicked' );
end;
procedure TForm1.NoClick(Sender: TObject);
begin
ShowMessage ( 'No clicked' );
end;
procedure TForm1.Button1Click(Sender: TObject);
var
c: integer;
const
UserMessage = 'Reply Yes or No';
begin
dlg := CreateMessageDialog(UserMessage, mtConfirmation, [mbYes,mbNo] );
(dlg.FindComponent ( 'Yes' ) as TButton).OnClick := YesClick;
(dlg.FindComponent ( 'No' ) as TButton).OnClick := NoClick;
dlg.Visible := true;
end;
If you need multiple MessageDialog forms to be visible at the same time then you should have multiple 'dlg' variables. For example 'dlg1', 'dlg2' and so on.
It would be sensible to disable the button that created the dialog once the dialog had been created. When you free the dialog you could enable the button.
I don't understand your last paragraph.
dlg[i]