Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Cash Count Out
#1
I am working up a count out dialog that will eventually be part of a simple book keeping program...here is what I have so far.

This is the dialog "Cash_Count":
Code:
Copy      Help
/Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages
;BEGIN DIALOG
;0 "" 0x10C80A44 0x100 0 0 135 135 "Cash Count"
;1101 Edit 0x54030080 0x200 40 6 16 14 ""
;1102 Edit 0x54030080 0x200 40 22 16 14 ""
;1103 Edit 0x54030080 0x200 40 38 16 14 ""
;1104 Edit 0x54030080 0x200 40 54 16 14 ""
;1105 Edit 0x54030080 0x200 40 70 16 14 ""
;1106 Edit 0x54030080 0x200 40 86 16 14 ""
;1107 Edit 0x54030080 0x200 40 102 16 14 ""
;1108 Edit 0x54030080 0x200 94 6 16 14 ""
;1109 Edit 0x54030080 0x200 94 22 16 14 ""
;1110 Edit 0x54030080 0x200 94 38 16 14 ""
;1111 Edit 0x54030080 0x200 94 54 16 14 ""
;1112 Edit 0x54030080 0x200 94 70 16 14 ""
;1113 Edit 0x54030080 0x200 94 86 16 14 ""
;1119 Edit 0x54030080 0x200 94 102 38 14 ""
;1 Button 0x54030001 0x4 22 120 48 14 "OK"
;2 Button 0x54030000 0x0 76 120 48 14 "Cancel"
;20 Static 0x54000000 0x0 12 8 48 12 "$100"
;21 Static 0x54000000 0x0 12 24 48 12 "$50"
;22 Static 0x54000000 0x0 12 40 48 12 "$20"
;23 Static 0x54000000 0x0 12 56 48 12 "$10"
;24 Static 0x54000000 0x0 12 72 48 12 "$5"
;25 Static 0x54000000 0x0 12 88 48 12 "$2"
;26 Static 0x54000000 0x0 12 104 48 12 "$1"
;27 Static 0x54000000 0x0 66 8 48 12 "$1"
;28 Static 0x54000000 0x0 66 24 48 12 "$0.50"
;29 Static 0x54000000 0x0 66 40 48 12 "$0.25"
;30 Static 0x54000000 0x0 66 56 48 12 "$0.10"
;31 Static 0x54000000 0x0 66 72 48 12 "$0.05"
;32 Static 0x54000000 0x0 66 88 48 12 "$0.01"
;33 Static 0x54000000 0x0 66 104 48 12 "TOTAL"
;END DIALOG
;DIALOG EDITOR: "" 0x2020105 "*" "1" ""

str controls = "1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1119"
str e1101 e1102 e1103 e1104 e1105 e1106 e1107 e1108 e1109 e1110 e1111 e1112 e1113 e1119
e1101="0"
e1102="0"
e1103="0"
e1104="0"
e1105="0"
e1106="0"
e1107="0"
e1108="0"
e1109="0"
e1110="0"
e1111="0"
e1112="0"
e1113="0"

if(!ShowDialog("Cash_Count" &Cash_Count &controls)) ret
ret
;messages
sel message
,case WM_INITDIALOG
,Cash_Math hDlg 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1119
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case EN_CHANGE<<16|1101
,Cash_Math hDlg 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1119
,case EN_CHANGE<<16|1102
,Cash_Math hDlg 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1119
,case EN_CHANGE<<16|1103
,Cash_Math hDlg 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1119
,case EN_CHANGE<<16|1104
,Cash_Math hDlg 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1119
,case EN_CHANGE<<16|1105
,Cash_Math hDlg 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1119
,case EN_CHANGE<<16|1106
,Cash_Math hDlg 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1119
,case EN_CHANGE<<16|1107
,Cash_Math hDlg 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1119
,case EN_CHANGE<<16|1108
,Cash_Math hDlg 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1119
,case EN_CHANGE<<16|1109
,Cash_Math hDlg 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1119
,case EN_CHANGE<<16|1110
,Cash_Math hDlg 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1119
,case EN_CHANGE<<16|1111
,Cash_Math hDlg 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1119
,case EN_CHANGE<<16|1112
,Cash_Math hDlg 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1119
,case EN_CHANGE<<16|1113
,Cash_Math hDlg 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1119
,case IDOK
,case IDCANCEL
,case LBN_SELCHANGE<<16|3

ret 1


Then the Math and stuff "Cash_Math":
Code:
Copy      Help
;/
function hDlg hundred fifty twenty ten five two one onec fiftyc quarterc dimec nickelc pennyc total
str sTotal
int sumHun sumFif sumTwe sumTen sumFiv sumTwo sumOne sumOnec sumFifc sumQuac sumDimc sumNicc sumPenc

str hundreds e1101.getwintext(id(hundred hDlg))
foreach(hundreds e1101) sumHun+val(hundreds)

str fiftys e1102.getwintext(id(fifty hDlg))
foreach(fiftys e1102) sumFif+val(fiftys)

str twentys e1103.getwintext(id(twenty hDlg))
foreach(twentys e1103) sumTwe+val(twentys)

str tens e1104.getwintext(id(ten hDlg))
foreach(tens e1104) sumTen+val(tens)

str fives e1105.getwintext(id(five hDlg))
foreach(fives e1105) sumFiv+val(fives)

str twos e1106.getwintext(id(two hDlg))
foreach(twos e1106) sumTwo+val(twos)

str ones e1107.getwintext(id(one hDlg))
foreach(ones e1107) sumOne+val(ones)

str onecs e1108.getwintext(id(onec hDlg))
foreach(onecs e1108) sumOnec+val(onecs)

str fiftycs e1109.getwintext(id(fiftyc hDlg))
foreach(fiftycs e1109) sumFifc+val(fiftycs)

str quartercs e1110.getwintext(id(quarterc hDlg))
foreach(quartercs e1110) sumQuac+val(quartercs)

str dimecs e1111.getwintext(id(dimec hDlg))
foreach(dimecs e1111) sumDimc+val(dimecs)

str nickelcs e1112.getwintext(id(nickelc hDlg))
foreach(nickelcs e1112) sumNicc+val(nickelcs)

str pennycs e1113.getwintext(id(pennyc hDlg))
foreach(pennycs e1113) sumPenc+val(pennycs)
CURRENCY Hun Fif Twe Ten Fiv Two One Onec Fifc Quac Dimc Nicc Penc sumTotal
Hun.mul(sumHun 100)
Fif.mul(sumFif 50)
Twe.mul(sumTwe 20)
Ten.mul(sumTen 10)
Fiv.mul(sumFiv 5)
Two.mul(sumTwo 2)
One.mul(sumOne 1)
Onec.mul(sumOnec 1)
Fifc.mul(sumFifc 0.5)
Quac.mul(sumQuac 0.25)
Dimc.mul(sumDimc 0.10)
Nicc.mul(sumNicc 0.05)
Penc.mul(sumPenc 0.01)

sumTotal.add(Hun Fif)
sumTotal.add(sumTotal Twe)
sumTotal.add(sumTotal Ten)
sumTotal.add(sumTotal Fiv)
sumTotal.add(sumTotal Two)
sumTotal.add(sumTotal One)
sumTotal.add(sumTotal Onec)
sumTotal.add(sumTotal Fifc)
sumTotal.add(sumTotal Quac)
sumTotal.add(sumTotal Dimc)
sumTotal.add(sumTotal Nicc)
sumTotal.add(sumTotal Penc)

sTotal=sumTotal
sTotal.setwintext(id(total hDlg))

A quick question about it all...how do I format the str so that it shows up as a dollar amount (i.e. $0.00)

I need to call the Count Out dialog from a button in a dialog (yet to be created) called "Deposit Form". Then grab the sTotal variable and put it in an edit box named TotalCash.

I just can't seem to get this to work. When I make an event for the button (case 4) and then put the function in there, QM states the function is expecting 4 arguments. I don't know what 4 it expects, but I wasn't planning on sending any in the first place!?!? A ShowDialog works here, but I don't think that's the right way to go about things at all, but it is the only way I have gotten any success at this.

Oh...and are there any ways to simplify the code I already have. I feel like it is a bit clunky. I am amazed I got what I have to work in the first place!

Please help.

Thanks.
#2
Move the code that shows the dialog to the parent dialog's function, or to a third function that the parent dialog calls. Example:

Tips: dialog code in the forum

Or, if you don't need to pass arguments, the parent dialog can call Cash_Count and pass four 0.

---

Simplifying:

Multiple case that have same code can be joined into one:

case [EN_CHANGE<<16|1101,EN_CHANGE<<16|1102,and so on]
Cash_Math hDlg 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1119

-

Don't need to declare so many str variables. Can reuse same variables.

Also could use arrays...

---

Passing result to parent dialog.

If you move ShowDialog etc to the parent dialog, the result will be in e1119. (after closing the counting dialog) (after ShowDialog).
#3
I don't understand where?

Quote:Passing result to parent dialog.

If you move ShowDialog etc to the parent dialog, the result will be in e1119. (after closing the counting dialog) (after ShowDialog).

could you give an example?

Thanks for the help so far. I simplified quite a bit based on your advice.

Now to just get to result of the count in the parent dialog. A simple example that I can hack apart would be sweet!

Thanks again.
#4
str controls = "1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1119"
str e1101 e1102 e1103 e1104 e1105 e1106 e1107 e1108 e1109 e1110 e1111 e1112 e1113 e1119
e1101="0"
e1102="0"
e1103="0"
e1104="0"
e1105="0"
e1106="0"
e1107="0"
e1108="0"
e1109="0"
e1110="0"
e1111="0"
e1112="0"
e1113="0"

if(!ShowDialog("Cash_Count" &Cash_Count &controls)) ret

out e1119
#5
Thanks for the quick reply, unfortunately I don't understand how that is supposed to work.

I know I am just missing something simple that I haven't learned yet. So here is the jist of my project.

Deposit Dialog
3 edit boxes and buttons
1. Cash Count Total w/button to cash count dialog
2. Check List Total w/button to check list button
3. Total Deposit w/ok button that updates an excel file

I'm getting hung up on getting the Cash Count Total to show up on the Deposit Dialog.

How do I get e1119 to show up in the Cash Count Total and Check List Total (which will be the same deal as the Cash Count Total) and sum for the Total Deposit.

Even if you scrap my work and just give me a simplified example of how I should go about filling a text box with a result from another dialog that would be great. I'll figure out the rest myself.

Thanks again.
#6
code that shows deposit dialog

Code:
Copy      Help
str controls = "3"
str e3
if(!ShowDialog("Deposit_Dialog" &Deposit_Dialog &controls)) ret

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

;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 223 135 "Dialog"
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;3 Edit 0x54030080 0x200 12 8 96 14 ""
;4 Button 0x54032000 0x0 118 8 48 14 "cash count"
;END DIALOG
;DIALOG EDITOR: "" 0x2020105 "" "" ""


ret
;messages
sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case 4 ;;cash count button clicked
,
,str controls = "1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1119"
,str e1101 e1102 e1103 e1104 e1105 e1106 e1107 e1108 e1109 e1110 e1111 e1112 e1113 e1119
,e1101="0"
,e1102="0"
,e1103="0"
,e1104="0"
,e1105="0"
,e1106="0"
,e1107="0"
,e1108="0"
,e1109="0"
,e1110="0"
,e1111="0"
,e1112="0"
,e1113="0"
,
,if(!ShowDialog("Cash_Count" &Cash_Count &controls)) ret
,
,e1119.setwintext(id(3 hDlg))

,case IDOK
,case IDCANCEL
ret 1

function Cash_Count
Code:
Copy      Help
;/Dialog_Editor
function# hDlg message wParam lParam

;BEGIN DIALOG
;0 "" 0x10C80A44 0x100 0 0 135 135 "Cash Count"
;1101 Edit 0x54030080 0x200 40 6 16 14 ""
;1102 Edit 0x54030080 0x200 40 22 16 14 ""
;1103 Edit 0x54030080 0x200 40 38 16 14 ""
;1104 Edit 0x54030080 0x200 40 54 16 14 ""
;1105 Edit 0x54030080 0x200 40 70 16 14 ""
;1106 Edit 0x54030080 0x200 40 86 16 14 ""
;1107 Edit 0x54030080 0x200 40 102 16 14 ""
;1108 Edit 0x54030080 0x200 94 6 16 14 ""
;1109 Edit 0x54030080 0x200 94 22 16 14 ""
;1110 Edit 0x54030080 0x200 94 38 16 14 ""
;1111 Edit 0x54030080 0x200 94 54 16 14 ""
;1112 Edit 0x54030080 0x200 94 70 16 14 ""
;1113 Edit 0x54030080 0x200 94 86 16 14 ""
;1119 Edit 0x54030080 0x200 94 102 38 14 ""
;1 Button 0x54030001 0x4 22 120 48 14 "OK"
;2 Button 0x54030000 0x0 76 120 48 14 "Cancel"
;20 Static 0x54000000 0x0 12 8 48 12 "$100"
;21 Static 0x54000000 0x0 12 24 48 12 "$50"
;22 Static 0x54000000 0x0 12 40 48 12 "$20"
;23 Static 0x54000000 0x0 12 56 48 12 "$10"
;24 Static 0x54000000 0x0 12 72 48 12 "$5"
;25 Static 0x54000000 0x0 12 88 48 12 "$2"
;26 Static 0x54000000 0x0 12 104 48 12 "$1"
;27 Static 0x54000000 0x0 66 8 48 12 "$1"
;28 Static 0x54000000 0x0 66 24 48 12 "$0.50"
;29 Static 0x54000000 0x0 66 40 48 12 "$0.25"
;30 Static 0x54000000 0x0 66 56 48 12 "$0.10"
;31 Static 0x54000000 0x0 66 72 48 12 "$0.05"
;32 Static 0x54000000 0x0 66 88 48 12 "$0.01"
;33 Static 0x54000000 0x0 66 104 48 12 "TOTAL"
;END DIALOG
;DIALOG EDITOR: "" 0x2020105 "*" "1" ""


;messages
sel message
,case WM_INITDIALOG
,Cash_Math hDlg 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1119
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case EN_CHANGE<<16|1101
,Cash_Math hDlg 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1119
,case EN_CHANGE<<16|1102
,Cash_Math hDlg 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1119
,case EN_CHANGE<<16|1103
,Cash_Math hDlg 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1119
,case EN_CHANGE<<16|1104
,Cash_Math hDlg 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1119
,case EN_CHANGE<<16|1105
,Cash_Math hDlg 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1119
,case EN_CHANGE<<16|1106
,Cash_Math hDlg 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1119
,case EN_CHANGE<<16|1107
,Cash_Math hDlg 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1119
,case EN_CHANGE<<16|1108
,Cash_Math hDlg 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1119
,case EN_CHANGE<<16|1109
,Cash_Math hDlg 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1119
,case EN_CHANGE<<16|1110
,Cash_Math hDlg 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1119
,case EN_CHANGE<<16|1111
,Cash_Math hDlg 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1119
,case EN_CHANGE<<16|1112
,Cash_Math hDlg 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1119
,case EN_CHANGE<<16|1113
,Cash_Math hDlg 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1119
,case IDOK
,case IDCANCEL
,case LBN_SELCHANGE<<16|3

ret 1
#7
e1119.setwintext(id(3 hDlg))

That's what I was after!

Haven't tried it yet, but thanks!!

Quick Macros is the best!
#8
Works great...but....

I see a problem though, when I go to establish a case for the second button I can't do it the same way by calling the dialog in the case for the button because of the "str controls="

What would you recommend?
#9
Nevermind. I just had to change the controls to controls1.

Works great! Thanks for all your help today.
#10
You can rename the second controls variable. But possibly you also have to rename more variables, therefore consider moving the codes that show the dialogs to two new functions. Let these functions return their results.
#11
This is another way.

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

;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 223 135 "Dialog"
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;3 Edit 0x54030080 0x200 12 8 96 14 ""
;4 Button 0x54032000 0x0 118 8 48 14 "cash count"
;END DIALOG
;DIALOG EDITOR: "" 0x2020105 "" "" ""


ret
;messages
sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case 4 ;;cash count button clicked
,
,str result
,if(!Cash_Count(0 0 0 &result)) ret
,result.setwintext(id(3 hDlg))

,case IDOK
,case IDCANCEL
ret 1

function Cash_Count
Code:
Copy      Help
/Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages
;BEGIN DIALOG
;0 "" 0x10C80A44 0x100 0 0 135 135 "Cash Count"
;1101 Edit 0x54030080 0x200 40 6 16 14 ""
;1102 Edit 0x54030080 0x200 40 22 16 14 ""
;1103 Edit 0x54030080 0x200 40 38 16 14 ""
;1104 Edit 0x54030080 0x200 40 54 16 14 ""
;1105 Edit 0x54030080 0x200 40 70 16 14 ""
;1106 Edit 0x54030080 0x200 40 86 16 14 ""
;1107 Edit 0x54030080 0x200 40 102 16 14 ""
;1108 Edit 0x54030080 0x200 94 6 16 14 ""
;1109 Edit 0x54030080 0x200 94 22 16 14 ""
;1110 Edit 0x54030080 0x200 94 38 16 14 ""
;1111 Edit 0x54030080 0x200 94 54 16 14 ""
;1112 Edit 0x54030080 0x200 94 70 16 14 ""
;1113 Edit 0x54030080 0x200 94 86 16 14 ""
;1119 Edit 0x54030080 0x200 94 102 38 14 ""
;1 Button 0x54030001 0x4 22 120 48 14 "OK"
;2 Button 0x54030000 0x0 76 120 48 14 "Cancel"
;20 Static 0x54000000 0x0 12 8 48 12 "$100"
;21 Static 0x54000000 0x0 12 24 48 12 "$50"
;22 Static 0x54000000 0x0 12 40 48 12 "$20"
;23 Static 0x54000000 0x0 12 56 48 12 "$10"
;24 Static 0x54000000 0x0 12 72 48 12 "$5"
;25 Static 0x54000000 0x0 12 88 48 12 "$2"
;26 Static 0x54000000 0x0 12 104 48 12 "$1"
;27 Static 0x54000000 0x0 66 8 48 12 "$1"
;28 Static 0x54000000 0x0 66 24 48 12 "$0.50"
;29 Static 0x54000000 0x0 66 40 48 12 "$0.25"
;30 Static 0x54000000 0x0 66 56 48 12 "$0.10"
;31 Static 0x54000000 0x0 66 72 48 12 "$0.05"
;32 Static 0x54000000 0x0 66 88 48 12 "$0.01"
;33 Static 0x54000000 0x0 66 104 48 12 "TOTAL"
;END DIALOG
;DIALOG EDITOR: "" 0x2020105 "*" "1" ""

str controls = "1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1119"
str e1101 e1102 e1103 e1104 e1105 e1106 e1107 e1108 e1109 e1110 e1111 e1112 e1113 e1119
e1101="0"
e1102="0"
e1103="0"
e1104="0"
e1105="0"
e1106="0"
e1107="0"
e1108="0"
e1109="0"
e1110="0"
e1111="0"
e1112="0"
e1113="0"

if(!ShowDialog("Cash_Count" &Cash_Count &controls)) ret

str& result=+lParam
result=e1119

ret 1

;messages
sel message
,case WM_INITDIALOG
,Cash_Math hDlg 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1119
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case EN_CHANGE<<16|1101
,Cash_Math hDlg 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1119
,case EN_CHANGE<<16|1102
,Cash_Math hDlg 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1119
,case EN_CHANGE<<16|1103
,Cash_Math hDlg 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1119
,case EN_CHANGE<<16|1104
,Cash_Math hDlg 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1119
,case EN_CHANGE<<16|1105
,Cash_Math hDlg 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1119
,case EN_CHANGE<<16|1106
,Cash_Math hDlg 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1119
,case EN_CHANGE<<16|1107
,Cash_Math hDlg 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1119
,case EN_CHANGE<<16|1108
,Cash_Math hDlg 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1119
,case EN_CHANGE<<16|1109
,Cash_Math hDlg 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1119
,case EN_CHANGE<<16|1110
,Cash_Math hDlg 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1119
,case EN_CHANGE<<16|1111
,Cash_Math hDlg 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1119
,case EN_CHANGE<<16|1112
,Cash_Math hDlg 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1119
,case EN_CHANGE<<16|1113
,Cash_Math hDlg 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1119
,case IDOK
,case IDCANCEL
,case LBN_SELCHANGE<<16|3

ret 1


When you explicitly call a dialog function, like in the example, the first argument must be 0, other arguments can be 0 or used to pass some values or variable addresses. When you pass an address, the function can cast it to a variable reference (eg str& s=+lParam) and store some value into the variable.
#12
Ok. One more question. How should I work with numbers that have decimals. So that the total will be the sum including the decimals. What I have so far seems to ignore any decimal. What should I do instead?

Code:
Copy      Help
;/
function hDlg Check1 Check2 Check3 Check4 Check5 Check6 Check7 Check8 Check9 Check10 Check11 total
str sTotal
int sumCheck1 sumCheck2 sumCheck3 sumCheck4 sumCheck5 sumCheck6 sumCheck7 sumCheck8 sumCheck9 sumCheck10 sumCheck11



str Check1s e4.getwintext(id(Check1 hDlg))
foreach(Check1s e4) sumCheck1+val(Check1s)
str Check2s e6.getwintext(id(Check2 hDlg))
foreach(Check2s e6) sumCheck1+val(Check2s)
;;Repeat for other Check entries

CURRENCY Ch1 Ch2 sumTotal

Ch1.mul(sumCheck1 1)
Ch2.mul(sumCheck2 1)
;;Repeat for other Check entries



sumTotal.add(Ch1 Ch2)



sTotal=sumTotal
sTotal.setwintext(id(total hDlg))

Thanks Again!!!
#13
Use double variables instead of int. CURRENCY also can be used.

Code:
Copy      Help
double d1(10.5) d2(1.5)
d1*d2
out d1

CURRENCY c1(10.5) c2(1.5)
c1.mul(c2)
out c1
#14
Gintaras Wrote:Use double variables instead of int. CURRENCY also can be used.



Code:
Copy      Help
double d1(10.5) d2(1.5)
d1*d2
out d1

CURRENCY c1(10.5) c2(1.5)
c1.mul(c2)
out c1
what is the CURRENCY function for minus i found the rest but cnt find this
#15
var.sub([align=left] right)

Subtracts (var = left - right).
#16
thx expert


Forum Jump:


Users browsing this thread: 1 Guest(s)