Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Calculator
#6
Okay, I'm making a mess.
I got the adding, subtracting, dividing, and multiplying to work, kind of, but you have to hit the button again to get the total, rather then hitting the total button. Is there a way to fix this?

Example: Hit 9 divided by 3 then hit divided key again and it gives you the answer, instead of hitting, 9 divided by 3 equals. Any idea how to fix this?


Function Calculator
Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages


str controls = "14 24"
str e14 e24
e24="0"
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
aaa=""
bbb=""
ccc=""
ddd=""
eee=""
fff=""
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
,act id(14 hDlg)
,f.getwintext(id(24 hDlg))
,fff=val(f)
,if fff=0
,,a.getwintext(id(14 hDlg))
,,a.setwintext(id(24 hDlg))
,,b=""
,,b.setwintext(id(14 hDlg))
,,goto top
,else goto divide

,case 17
,f.getwintext(id(24 hDlg))
,fff=val(f)
,if fff=0
,,a.getwintext(id(14 hDlg))
,,a.setwintext(id(24 hDlg))
,,b=""
,,b.setwintext(id(14 hDlg))
,,goto top
,else goto multiply

,case 18
,act id(14 hDlg)
,f.getwintext(id(24 hDlg))
,fff=val(f)
,if fff=0
,,a.getwintext(id(14 hDlg))
,,a.setwintext(id(24 hDlg))
,,b=""
,,b.setwintext(id(14 hDlg))
,,goto top
,else goto subtract

,case 19
,act id(14 hDlg)
,f.getwintext(id(24 hDlg))
,fff=val(f)
,if fff=0
,,a.getwintext(id(14 hDlg))
,,a.setwintext(id(24 hDlg))
,,b=""
,,b.setwintext(id(14 hDlg))
,,goto top
,else goto add

,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=a
,bb=f
,cc.div(bb aa)
,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=a
,bb=f
,cc.mul(bb aa)
,d=cc
,d.setwintext(id(24 hDlg))
,b.setwintext(id(14 hDlg))
,out "hello2"
,goto top

,;add
,a.getwintext(id(14 hDlg))
,f.getwintext(id(24 hDlg))
,aa=a
,bb=f
,cc.add(bb aa)
,d=cc
,d.setwintext(id(24 hDlg))
,b.setwintext(id(14 hDlg))
,out "hello3"
,goto top

,;subtract
,a.getwintext(id(14 hDlg))
,f.getwintext(id(24 hDlg))
,aa=a
,bb=f
,cc.sub(bb aa)
,d=cc
,d.setwintext(id(24 hDlg))
,b.setwintext(id(14 hDlg))
,out "hello4"
,goto top
,
,;bottom
,a.getwintext(id(24 hDlg))
,aaa=val(a)
,if aaa=0
,,a.getwintext(id(14 hDlg))
,,a.setwintext(id(24 hDlg))
,else
,,out "success"
,'total
,case IDOK
,case IDCANCEL
ret 1
Taking on Quick Macros one day at a time


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)