Unicode friendly means endless usages, really very easilly. The dialog below uses several languages from different character sets.
To get the Unicodes, first I used Google translator to translate the word "Welcome". The results were pasted to one among many Unicode translators, like Branah -
. Just paste your text and it will provides the unicodes. Make sure to check the "Remove \u", and when pasting, make sure to separate every character with a space. In general, for most languages you'll use 4 characters. For double byte languages, like Chinese, Japanese and Korean, or for some special characters, like the "thumbs up", you'll pass every 8 characters at a time.
Sample 7: Predefined unicode buttons:
For the basic captions: "Ok, Cancel, Print, Save and Search", add an "*", and the corresponding unicode icon will be added to the button, as below:
? FoxyDialog("Playing with Unicodes in buttons", ;
"Predefined buttons", ;
"There are currently 5 predefined buttons that will add a unicode icon automatically." + CHR(13) + CHR(13) + ;
"Add an asterisk - '*' after the words below, and the corresponding icons will be added to the buttons:" + CHR(13) + CHR(13) + ;
" Ok* <UC>27f6</UC> Ok <UC>2713</UC>" + CHR(13) + ;
" Cancel* <UC>27f6</UC> Cancel <UC>d83dddd9</UC>" + CHR(13) + ;
" Print* <UC>27f6</UC> Print <UC>2399</UC>" + CHR(13) + ;
" Save* <UC>27f6</UC> Save <UC>d83dddab</UC>" + CHR(13) + ;
" Search* <UC>27f6</UC> Search <UC>d83ddd0e</UC>", ;
"I", ;
"Ok*,Cancel*,Print*,Save*,Search*") && Button captions
Sample 8: Custom title with no icon, and with background:
Notice the icon parameter - the comma separated string - ",S" means that there will be no main icon, but with a silver background:
* Sample 8
? FoxyDialog("Covid-19 warning", ;
"Custom title with no icon and background" + CHR(13) + "PLEASE STAY HOME!" + CHR(13) + "I hope you'll keep your word!", ;
" - Clean your hands often." + CHR(13) + ;
" - Avoid close contact with people who are sick." + CHR(13) + ;
" - Stay at home as much as possible." + CHR(13) + ;
" - Put distance between yourself and other people." + CHR(13) + ;
" - If you have a fever, cough and difficulty breathing, seek medical attention." + CHR(13), ;
",S", ; && No icon, silver background
"\More Info,I agree,Leave me!") && Button captions, 1st button disabled
Sample 9: Buttons with custom icons, from Imageres.dll and Shell32.dll
Notice the index numbers in the button captions parameters. These come immediately after every caption.
* Sample 9
? FoxyDialog("Covid-19 crazy warning - See the timer -->", ;
"Please stay home!", ;
" - Clean your hands often." + CHR(13) + ;
" - Avoid close contact with people who are sick." + CHR(13) + ;
" - Stay at home as much as possible." + CHR(13) + ;
" - Put distance between yourself and other people." + CHR(13) + ;
" - If you have a fever, cough and difficulty breathing, seek medical attention." + CHR(13), ;
"!2", ; && Exlamation default with yellow backgound (default)
"\More Info_99,I agree_5341,Leave me!_89,Ok_116802", ; && Button captions, 1st button disabled
2, ; && Default button
"8000,<SECS> secs.") && Timeout
Sample 10: Predefined buttons icons:
The icon parameter has the special characters: "I,B", meaning the Information icon, and the blue background
For the basic captions: "Ok, Cancel, Print, Save and Search", add an "#", and the corresponding unicode icon will be added to the button, as below:
* Sample 10
? FoxyDialog("Playing with real icons in buttons", ;
"Custom title icon and background!" + CHR(13) + "Predefined buttons with colored icons", ;
"There are currently 5 predefined buttons that will add some colored icons automatically." + CHR(13) + CHR(13) + ;
"Add an HASHTAG - '#' after the words below, and the corresponding icons will be added to the buttons:" + CHR(13) + CHR(13) + ;
" - Ok# " + CHR(13) + ;
" - Cancel# " + CHR(13) + ;
" - Print# " + CHR(13) + ;
" - Save# " + CHR(13) + ;
" - Search# ", ;
"I,B", ; && Information icon, blue background
"Ok#,Cancel#,Print#,Save#,Search#") && Button captions
Sample 11: Green background with custom icon, and unicodes
* Sample 11
? FoxyDialog("Playing with Unicodes in buttons", ;
"You did it!!!" + CHR(13) + "Custom title icon and background!" + CHR(13) + "Predefined unicode buttons", ;
"There are currently 5 predefined buttons that will add a unicode icon automatically." + CHR(13) + CHR(13) + ;
"Add an asterisk - '*' after the words below, and the corresponding icons will be added to the buttons:" + CHR(13) + CHR(13) + ;
" Ok* <UC>27f6</UC> Ok <UC>2713</UC>" + CHR(13) + ;
" Cancel* <UC>27f6</UC> Cancel <UC>d83dddd9</UC>" + CHR(13) + ;
" Print* <UC>27f6</UC> Print <UC>2399</UC>" + CHR(13) + ;
" Save* <UC>27f6</UC> Save <UC>d83dddab</UC>" + CHR(13) + ;
" Search* <UC>27f6</UC> Search <UC>d83ddd0e</UC>", ;
"Ok3,G", ; && Ok icon, green background
"Ok*,Cancel*,Print*,Save*,Search*") && Button captions
Sample 12: Basic INPUTBOX() dialog with custom icon, image buttons, and timeout
* Sample 12 - INPUTBOX
* - The 5th parameter determines the INPUTBOX() type
* - Custom ICO file
* - Active timeout
* - E-mail icon from https://www.creativefreedom.co.uk/icon-designers-blog/email-icon-android-ios-win-app-icon/
? FoxyDialog("New inputbox dialog", ;
"E-mail registration", ;
"Please enter your e-mail from a secure server", ;
"email.ico,S", ; && MAIL icon, BLUE background
"@I,Ok#,Cancel#", ; && Buttons, the '@I' at the beginning means INPUTBOX mode
"johndoe@doeenterprises.com", ; && Default text
"58000,<SECS> secs.") && Timeout
Sample 13: Password INPUTBOX() dialog with custom icon, image buttons, and timeout
* Sample 13 - PASSWORD INPUTBOX
* The '@IP' parameter does the trick
? FoxyDialog("New PASSWORD dialog", ;
"Server Access", ;
"Please enter the server access password" + CHR(13) + ;
"Press the CAPS-LOCK key to see the balloontip!", ;
"LOCK", ; && LOCK icon, BLUE background
"@IP,Ok#,Cancel#", ; && Buttons, the '@IP' at the beginning means PASSWORD INPUTBOX mode
"Password1234", ; && Default text
"58000,<SECS> secs.") && Timeout
Sample 14: Uppercase INPUTBOX() dialog
* Sample 14 - UPPERCASE INPUTBOX
? FoxyDialog("New inputbox dialog", ;
"FORMATTED INPUTBOX", ;
"All text entered will be converted to UPPERCASE", ;
"OK3", ; && 'Ok' icon, EMPTY background
"@I!,Ok#,Cancel#", ; && Buttons, the '@I!' at the beginning means Uppercase INPUTBOX mode
"This is your default text", ; && Default text
"58000,<SECS> secs.") && Timeout
Sample 14b: Numeric INPUTBOX() dialog
* Sample 14b - NUMERIC INPUTBOX
lnValue = FoxyDialog("New inputbox dialog", ;
"Enter the amount you need to withdraw from your account", ;
"This control accepts only numeric keys and one point", ;
"Money3.ico,B", ; && Custom Money icon, BLUE background
"@IN,Ok#,Cancel#", ; && Buttons, the '@IN' at the beginning means Numeric INPUTBOX mode
123456.78) && Default value
? lnValue, VARTYPE(lnValue)
Sample 15: Month Calendar INPUTBOX() dialog
* Sample 15 - MONTH INPUTBOX
? FoxyDialog("New Month Inputbox dialog", ;
"Date select", ;
"Please enter your date of birth", ;
"Calendar2.ico,B", ; && Calendar2 icon, BLUE background
"@M,Ok#,Cancel#", ; && Buttons, the '@M' at the beginning means MONTHBOX mode
CTOD("01/12/2019"), ; && Default date
"58000,<SECS> secs.") && Timeout
Sample 16: Date INPUTBOX() dialog
* Sample 16 - DATE INPUTBOX
? FoxyDialog("New Date Input dialog", ;
"Date select", ;
"Please enter your date of birth", ;
"Calendar4.ico", ; && Custom Calendar.ICO icon, no background
"@D,Ok#,Cancel#", ; && Buttons, the '@D' at the beginning means DATEBOX mode
CTOD("01/12/2019"), ; && Default date
"58000,<SECS> secs.") && Timeout
Sample 17: DateTime INPUTBOX() dialog
* Sample 17 - DATETIME INPUTBOX
? FoxyDialog("New DateTime box dialog", ;
"Date and Time select", ;
"Please enter the date and time of estimated delivery", ;
"DateTime1.ico,B", ; && DateTime.ico, BLUE background
"@T,Ok#,Cancel#", ; && Buttons, the '@T' at the beginning means DATETIMEBOX mode
DATETIME(), ;
"58000,<SECS> secs.") && Timeout
Sample 18: Month Calendar date range INPUTBOX() dialog
* Sample 18 - MONTH CALENDAR RANGE INPUTBOX
* The date selection is returned in the 'loDatesRange' object as below
loDatesRange = FoxyDialog("New Datebox range dialog", ;
"Date range select", ;
"Please enter the date range for your report", ;
"Calendar1.ico,S", ; && LOCK icon, BLUE background
"@R,Ok#,Cancel#", ; && Buttons, the '@M' at the beginning means MONTHBOX mode
CTOD("01/12/2019"), ; && Default text
"120000,<SECS> secs.") && Timeout
? "Initial date:", loDatesRange.StartDate
? "Final date:" , loDatesRange.EndDate
APPENDIX 1:
The image below shows all the icons stored in ImageRes.Dll. Each icon comes with an ID. Vhoose your button, and pass its ID number to the "tcnIcon" parameter to have it displayed in your dialog.
First of all, thanks very much for the positive feedback, bug reports and suggestions from my friends from Foxite
- When "ESC" or the dialog closed by clicking at the "X" button made the function wrongly return the value "2"
They seem to be very simple, but were really very tricky to fix.
The TaskDialog API does not allow almost any external interference, and this obliged me to test several aproaches to try to bypass it. Hopefully things will run fine now.
The most annoying difficulty was with the fact that I could not resize the buttons. This obliged me to use the original "Cancel" button, that had its caption renamed. But whenever the user clicked on the "X" or pressed <ESC> , the Dialog interpreted that the button that originally was named as "Cancel" was pressed. I had to control the WM_KEYUP Windows event, detect if <ESC> was pressed, and change the returned value.
I could not hide the "X" button. I tried several aproaches that usually work in normal forms, but all I could do is to disable it.
If the dialog has 3 or more buttons, pressing <ESC> will close the dialog, returning the value 0 - ZERO.