EntryForm() - easy, custom InputBox, data entry forms
Posted: 13 Sep 2014, 09:07
Syntax: ef := EntryForm( form, fields* )
Return Value: { "event": [ OK, Cancel, Close, Escape, Timeout ], "output": [ field1 , field2 ... ] }
Parameters: see Parameters
Example:
Code: Select all
#Include <EntryForm>
form := "
(Join`s C
-c 'EntryForm Test' ; window caption/title
-ico cmd.exe,0 ; window icon
x0 y0 w600 ; window position
fEntryForm_Callback ; callback function
)"
fields := [ "
(Join`s C
-p 'Single-line input field:' ; prompt
-d 'Default text' ; default text
)", "
(Join`s C
-p 'Multi-line input field with select file/folder buttons:'
-fnt ';s10 cBlue,Consolas'
-tt 'A tooltip may be attached to the input field' ; tooltip
-fs 'm3,C:\Program Files\AutoHotkey' ; select file button
-ds 'C:\,3,Select a folder:' ; select folder button
-Wrap +HScroll r5 ; standard options
)", "
(Join`s C
-p 'Password (customized prompt font):'
-fnt 's10 cRed;s10 Italic,Segoe UI' ; font
-cb 'Password must be atleast 8 chars <- Cuebanner' ; cuebanner
Password
)", "
(Join`s C
-p 'ComboBox:' *CB ; ComboBox input field
-d 'Red||Blue|Yellow|Green|Orange|Purple' ; use -d for control's text
)", "
(Join`s C
-p 'DropDownList:' *DDL ; DDL input field
-d 'Red|Blue|Yellow||Green|Orange|Purple'
)", "
(Join`s C
-p 'Choose item (uses ListBox control):' *LB ; ListBox input field
-d 'Item 1|Item 2||Item 3|Item 4|Item 5|Item 6'
r3
)", "
(Join`s C
-p 'Set Date (uses DateTime control):' *DT ; DateTime input field
)", "
(Join`s C
-p 'Input field with attached UpDown control:'
-ud 'Range1-20 Wrap' ; UpDown options
)" ]
EntryForm(form, fields*)
return
EntryForm_Callback(ef) {
out := "Event: " . ef.event . "`n"
for i, contents in ef.output
out .= "`nField " . i . ": " . contents
MsgBox %out%
}
Source: On GitHub