07-29-2008, 05:11 PM
Here is a quick example of manipulating edit box values:
Function Dialog2
with the getwintext/setwintext you can pretty much get data and put it where ever you want.
Function Dialog2
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages
;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 75 110 "Dialog"
;1 Button 0x54030001 0x4 18 72 48 14 "OK"
;2 Button 0x54030000 0x4 18 86 48 14 "Cancel"
;3 Edit 0x54030080 0x200 20 14 42 14 ""
;4 Edit 0x54030080 0x200 20 32 42 14 ""
;5 Edit 0x54030080 0x200 20 50 42 14 ""
;END DIALOG
;DIALOG EDITOR: "" 0x2030001 "" "" ""
str controls = "3 4 5"
str e3 e4 e5
e3="$0.00"
e4="$0.00"
e5="$0.00"
if(!ShowDialog("Dialog2" &Dialog2 &controls)) ret
ret
;messages
sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
;Formats text in e3 when click out (ie $1,000.00)
,case EN_KILLFOCUS<<16|3
,str wText1.getwintext(id(3 win("Dialog" "#32770")))
,wText1.trim('$')
,wText1.findreplace("," "")
,double cText1
,cText1=val(wText1 2)
,wText1.format("$%.2f" cText1)
,strrev wText1
,wText1.replacerx("(\d{3})(?=\d+($|[^\.\w]))" "$1,")
,strrev wText1
,wText1.setwintext(id(3 win("Dialog" "#32770")))
;Formats text in e3 when click out (ie $1,000.00)
,case EN_KILLFOCUS<<16|4
,str wText2.getwintext(id(4 win("Dialog" "#32770")))
,wText2.trim('$')
,wText2.findreplace("," "")
,double cText2
,cText2=val(wText2 2)
,wText2.format("$%.2f" cText2)
,strrev wText2
,wText2.replacerx("(\d{3})(?=\d+($|[^\.\w]))" "$1,")
,strrev wText2
,wText2.setwintext(id(4 win("Dialog" "#32770")))
;Updates when text is changed in e3 and e4
,case [EN_CHANGE<<16|3,EN_CHANGE<<16|4]
,;gets window text from text box id 3 and assigns it to CURRENCY c1
,double c1
,wText1.getwintext(id(3 win("Dialog" "#32770")))
,wText1.trim('$')
,wText1.findreplace("," "")
,c1=val(wText1 2)
,;gets window text from text box id 4 and assigns it to CURRENCY c2
,double c2
,wText2.getwintext(id(4 win("Dialog" "#32770")))
,wText2.trim('$')
,wText2.findreplace("," "")
,c2=val(wText2 2)
,out c1
,out c2
,;math section...can be anything you want to see. Right now just adds the two
,double c3=c1+c2
;Formats the final output (ie $1,000.00)
,str Total.format("$%.2f" c3)
,strrev Total
,Total.replacerx("(\d{3})(?=\d+($|[^\.\w]))" "$1,")
,strrev Total
,Total.setwintext(id(5 win("Dialog" "#32770")))
,
,case IDOK
,case IDCANCEL
ret 1
with the getwintext/setwintext you can pretty much get data and put it where ever you want.