community.borland.com

Article #16422: Using InputBox, InputQuery, and ShowMessage

 Technical Information Database

TI1422D.txt   Using InputBox, InputQuery, and ShowMessage
Category   :General Programming
Platform    :All
Product    :Delphi  1.0

Description:

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;


Reference:


7/16/98 4:34:11 PM
 

Last Modified: 01-SEP-99