This library makes it easier for you to create dialogs that make it easier for users to communicate with data such as date, time, password, or display a message to the user.
This is the most basic form of dialog to display a message.
Syntax
procedure dialogAlert(title, msg: string; wait: boolean);
Parameters;
title
is the title of the dialogmsg
is the content to be notified.wait
if value istrue
, the program will be block until the dialog closed
Example
Uses
aDialog;
Var
title, msg, result: string;
Begin
title := 'Hello';
msg := 'This is Pascal NIDE';
DialogAlert(title, msg, true); //<==
Readln;
End.
This is a dialog which displayed a edit text for the user to enter data
Syntax
function dialogGetInput(title, hint, defaultText: string): string;
Parameters
title
is the title of the dialoghint
is a hintdefaultText
is the default string that will be displayed
Example
Uses
aDialog;
Var
title, hint, result: string;
Begin
title := 'What''s your name?';
hint := 'Enter here';
result := dialogGetInput(title, hint, ''); //<==
Writeln('hello' + result);
Readln;
End.
This is a dialog which displayed a edit text for the user to enter the password
Syntax
function dialogGetPassword(title, hint: string): string;
Parameters
title
is the title of the dialoghint
is a hint
Example
Uses
aDialog;
Var
title, hint, result: string;
Begin
title := 'What is your password?';
hint := 'enter here';
result := dialogGetPassword(title, hint);
Writeln('Your password is', result);
Readln;
End.
This is a dialog which display a time picker for the user to select the time
Syntax
function dialogGetTime(defHour, defMinute: integer; is24h: boolean): org_json_JSONObject;
Parameters
defHour
is default hourdefMinute
is default minuteis24h
: if value istrue
, the dialog will be display mode 24h, else 12h
JSON is a special type of data that works in pairs of <key, value>
- To get time we use the key
hour
- Want to take minutes we use the key
minute
Example
Uses
aDialog;
Var
result: org_json_JSONObject;
Minute: Integer;
Hour: Integer;
Begin
// hh/mm 24h
result := dialogGetTime(10, 20, true);
Hour := result.getInt('hour');
Minute := result.getInt('minute');
Writeln('time =', hour, ':', minute);
End.
This is a dialog that displays a dialog box for the user to select a date
Syntax
function dialogGetDate(defYear, defMonth, defDay: integer): org_json_JSONObject;
JSON is a special type of data that works in pairs of <key, value>
- Want to retrieve the year using the key
year
- To get months we use the key
month
- Want to get the date we use the key
day
Example
Uses
aDialog;
Var
result: org_json_JSONObject;
Year, month, day: Integer;
Begin
// yyyy / mm / dd
result := dialogGetDate(2017, 7, 12);
Year := result.getInt('year');
Month := result.getInt('month');
Day := result.getInt('day');
Writeln('date =', day, '/', month, '/', year);
End