Saturday, October 10, 2009

Using InputBox function

If you don't feel like creating complex forms just so you can ask the user for hes name or age, etc... then you can use the InputBox function which takes 3 parameters
function InputBox(const ACaption, APrompt, ADefault: string): string;
it's defined in Dialogs.pas unit.
Example of usage
var sValue: String;
     sValue := InputBox('User input','Your nickname', 'nick');
     if sValue <> '' then
        ShowMessageFmt('Your nickname is "%s".', [sValue]);

No comments:

Post a Comment

Blogroll(General programming and Delphi feeds)