07-31-2008, 03:45 PM
I don't think I'm capable of making this with one edit box, like you have in your example. That's how I originally started, but I had to make some adjustments to mine to get it to work.
But I'm making some progress, I got almost everything working but for some reason I get the error exception, and I'm not sure why?
Example: 4 x 5 total then hit divide and you get error exception.
Function Calculator
But I'm making some progress, I got almost everything working but for some reason I get the error exception, and I'm not sure why?
Example: 4 x 5 total then hit divide and you get error exception.
Function Calculator
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages
str controls = "14 24"
str e14 e24
e24="0.00"
str- a b c d e f
a=""
b=""
c=""
d=""
e=""
f=""
CURRENCY- aa bb cc dd ee ff
aa="1"
bb="1"
cc="1"
dd="1"
ee="1"
ff="1"
int- aaa bbb ccc ddd eee fff ggg hhh iii jjj
aaa=""
bbb=""
ccc=""
ddd=""
eee=""
fff=""
ggg=""
hhh=""
iii=""
jjj=""
if(!ShowDialog("Calculator" &Calculator &controls)) ret
;BEGIN DIALOG
;0 "" 0x90CB0A44 0x100 0 0 187 122 "QM Calculator"
;3 Button 0x54032000 0x0 56 30 20 16 "1"
;4 Button 0x54032000 0x0 76 30 20 16 "2"
;5 Button 0x54032000 0x0 96 30 20 16 "3"
;6 Button 0x54032000 0x0 56 46 20 16 "4"
;7 Button 0x54032000 0x0 76 46 20 16 "5"
;8 Button 0x54032000 0x0 96 46 20 16 "6"
;9 Button 0x54032000 0x0 56 62 20 16 "7"
;10 Button 0x54032000 0x0 76 62 20 16 "8"
;11 Button 0x54032000 0x0 96 62 20 16 "9"
;12 Button 0x54032000 0x0 76 78 20 16 "0"
;14 Edit 0x54030082 0x50280 26 10 84 14 ""
;15 Button 0x54032000 0x0 116 30 20 16 "/"
;16 Button 0x54032000 0x0 96 78 20 16 "."
;17 Button 0x54032000 0x0 116 46 20 16 "X"
;18 Button 0x54032000 0x0 116 62 20 16 "-"
;19 Button 0x54032000 0x0 116 78 20 16 "+"
;20 Button 0x54032000 0x0 56 78 20 16 "+/-"
;21 Button 0x54032000 0x0 28 98 42 14 "Backspace"
;22 Button 0x54032000 0x0 70 98 42 14 "Clear"
;23 Button 0x54032000 0x0 112 98 48 14 "Total"
;24 Edit 0x54030082 0x200 110 10 50 14 ""
;13 Button 0x54020007 0x0 16 0 154 118 ""
;END DIALOG
;DIALOG EDITOR: "" 0x2030001 "" "" ""
ret
;messages
sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,;top
,case 3
,act id(14 hDlg)
,'1
,case 4
,act id(14 hDlg)
,'2
,case 5
,act id(14 hDlg)
,'3
,case 6
,act id(14 hDlg)
,'4
,case 7
,act id(14 hDlg)
,'5
,case 8
,act id(14 hDlg)
,'6
,case 9
,act id(14 hDlg)
,'7
,case 10
,act id(14 hDlg)
,'8
,case 11
,act id(14 hDlg)
,'9
,case 12
,act id(14 hDlg)
,'0
,case 16
,act id(14 hDlg)
,'.
,case 15
,ggg=1
,act id(14 hDlg)
,f.getwintext(id(24 hDlg))
,fff=val(f)
,if fff=0.00
,,a.getwintext(id(14 hDlg))
,,a.setwintext(id(24 hDlg))
,,b=""
,,b.setwintext(id(14 hDlg))
,,goto top
,else goto bottom
,case 17
,ggg=2
,f.getwintext(id(24 hDlg))
,fff=val(f)
,if fff=0.00
,,a.getwintext(id(14 hDlg))
,,a.setwintext(id(24 hDlg))
,,b=""
,,b.setwintext(id(14 hDlg))
,,goto top
,else goto bottom
,case 18
,ggg=3
,act id(14 hDlg)
,f.getwintext(id(24 hDlg))
,fff=val(f)
,if fff=0.00
,,a.getwintext(id(14 hDlg))
,,a.setwintext(id(24 hDlg))
,,b=""
,,b.setwintext(id(14 hDlg))
,,goto top
,else goto bottom
,case 19
,ggg=4
,act id(14 hDlg)
,f.getwintext(id(24 hDlg))
,fff=val(f)
,if fff=0.00
,,a.getwintext(id(14 hDlg))
,,a.setwintext(id(24 hDlg))
,,b=""
,,b.setwintext(id(14 hDlg))
,,goto top
,else goto bottom
,case 20
,act id(14 hDlg)
,'-
,case 21
,act id(14 hDlg)
,'B
,case 22
,act id(14 hDlg)
,b.setwintext(id(14 hDlg))
,b.setwintext(id(24 hDlg))
,case 23
,goto bottom
,;divide
,a.getwintext(id(14 hDlg))
,f.getwintext(id(24 hDlg))
,aa=val(a)
,bb=val(f)
,cc=0
,cc.div(bb aa);; error exception
,d=cc
,d.setwintext(id(24 hDlg))
,b.setwintext(id(14 hDlg))
,out "hello1"
,goto top
,;multiply
,a.getwintext(id(14 hDlg))
,f.getwintext(id(24 hDlg))
,aa=val(a)
,bb=val(f)
,cc=0
,cc.mul(bb aa);; error exception
,d=cc
,d.setwintext(id(24 hDlg))
,b.setwintext(id(14 hDlg))
,out "hello2"
,goto top
,;subtract
,a.getwintext(id(14 hDlg))
,f.getwintext(id(24 hDlg))
,aa=val(a)
,bb=val(f)
,cc=0
,cc.sub(bb aa)
,d=cc
,d.setwintext(id(24 hDlg))
,b.setwintext(id(14 hDlg))
,out "hello4"
,goto top
,;add
,a.getwintext(id(14 hDlg))
,f.getwintext(id(24 hDlg))
,aa=val(a)
,bb=val(f)
,cc=0
,cc.add(bb aa)
,d=cc
,d.setwintext(id(24 hDlg))
,b.setwintext(id(14 hDlg))
,out "hello3"
,goto top
,
,;bottom
,if ggg=1
,,goto divide
,if ggg=2
,,goto multiply
,if ggg=3
,,goto subtract
,if ggg=4
,,goto add
,else
,,out "success"
,'total
,case IDOK
,case IDCANCEL
ret 1
Taking on Quick Macros one day at a time