- - * - WhiteUnicorn - * - -




* #WhiteUnicorn/ StartPage/ Documentation/DelphiFAQ >


3157:Using InputBox, InputQuery, and ShowMessage

KEYWORDS: showmessage, inputbox, inputquery, AREA: General


This function will demonstrate 3 very powerful and useful
procedures built into Delphi.

The InputBox and InputQuery both allow user input.

Use the InputBox function when it doesn't matter if the user
chooses either the OK button or the Cancel button (or presses
Esc) to exit the dialog box. When your application needs to
know if the user chooses OK or Cancel (or presses Esc), use
the InputQuery function.

The ShowMessage is another simple way of displaying a message
to the user.


procedure TForm1.Button1Click(Sender: TObject);
var s, s1: string;
    b: boolean;
begin
  s := Trim(InputBox('New Password', 'Password', 'masterkey'));
  b := s <> '';
  s1 := s;

  if b then
    b := InputQuery('Confirm Password', 'Password', s1);

  if not b or (s1 <> s) then
    ShowMessage('Password Failed');
end;

        TI



* #WhiteUnicorn/ StartPage/ Documentation/DelphiFAQ >



- - * - Anastasija aka WhiteUnicorn - * - - LJLiveJournal
PFPhotoFile