// Extra attributes that can be set for CREATE CONTROL EDITBOX
// 1) Determine if the contents have changed
// 2) Turn the caret on/off
// 3) Make the edit box a password entry box
// 4) Make the editbox READONLY
// 5) Undo changes made to editbox

// Windows API function calls
declare pfunc SendMessage returning integer in dll user.exe
declare pfunc HideCaret returning integer in dll user.exe
declare pfunc ShowCaret returning integer in dll user.exe

#define EM_GETMODIFY			1032
#define EM_UNDO					1047
#define EM_SETPASSWORDCHAR	1052
#define EM_SETREADONLY		1055

sSaveVar = ''

// Create the editbox
create control editbox 'Edit01' at 0,0 save to sSaveVar size 1,20

// Get the window handle for the editbox
hWnd = HWND('Edit01')

@ 2,0 say
wait 

// Has the contents of the edit box changed?
// Return value is non-zero if the contents have changed
if (SendMessage(toint(hWnd), toint(EM_GETMODIFY), toint(0), tolong(0)))
	wait 'Contents have changed'
else
	wait 'Contents have not changed'
endif

// Hide the caret.
// Note: The caret appears for a split-second, since the editbox is 
// originally created with one, then we turn it off.
HideCaret(toint(hWnd))
wait 'The caret is hidden'

// Show the caret
ShowCaret(toint(hWnd))
wait 'The caret is shown'

// Set the password character to 42 (decimal), which is '*' in ASCII.
// Password character can be set to almost any character
// Note: This will not work on a multi-line editbox.
SendMessage(toint(hWnd), toint(EM_SETPASSWORDCHAR), toint(42), tolong(0))
// Characters will not change until the editbox is updated
update control 'Edit01'
wait 'Password character set'

// Show contents of the editbox
? sSaveVar
wait 'Contents of editbox'

// Turn off the password character
SendMessage(toint(hWnd), toint(EM_SETPASSWORDCHAR), toint(0), tolong(0))
// Asterisks will stay in editbox until updated
update control 'Edit01'
wait 'Password character removed'

// Set READONLY
SendMessage(toint(hWnd), toint(EM_SETREADONLY), toint(1), tolong(0))
wait 'Editbox is READONLY'

// Clear READONLY
SendMessage(toint(hWnd), toint(EM_SETREADONLY), toint(0), tolong(0))
wait 'READONLY cleared'

// Undo changes
SendMessage(toint(hWnd), toint(EM_UNDO), toint(0), tolong(0))
wait 'Changes Un-done'