Jump to content

Recommended Posts

Posted

Say, I create a gui that has the following qualifications:

Three input boxes

One label

One button *optional

I want the fist input box to be a starting balance. The second input box will be for a payment and the third for a deposit, all should be able to accept only dollar amounts and cents i.e. 100.00, 2.50 etc... The fourth element, a label will be where the remaining balance will show. The label won't be editable -it will just show the dollar amount of the equation. Now, depending on simplicity; I would like the calculations to be done as the numbers are entered in the fields but if it's too big of a deal to pull off a button to do the calculations will be fine.

What I need as a formula is this:

take the starting balance and subtract out the payment and then add the deposit t = the balance

I have tried various versions of this

While GuiMsg()>0
$n=GuiRead($startbalance)-GuiRead($payment)+GuiRead($deposit)
GuiWrite($balance,0,$n)
Wend

and this is the whole code I am trying to use

Opt("GuiNotifyMode",1)
GUICreate("My balance GUI")
$startbalance = GuiSetControl ("input", "0", 10, 10, 50)
GuiSetControlEx(-1,256)
GuiSetControl("label","-",65,10,10,20)
$payment = GuiSetControl ("input", "0", 70, 10, 50) 
GuiSetControl("label","+",125,10,10,20)
$deposit = GuiSetControl ("input", "0", 130, 10, 50) 
GuiSetControl("label","=",185,10,-1,20)
$balance = GuiSetControl ("Label", "0", 195, 10, 50) 
GuiSetControl("button","OK",10,50,50)

;($balance - $payment) + $deposit = $balance
While GuiMsg()>0
$n=GuiRead($startbalance)-GuiRead($payment)+GuiRead($deposit)
GuiWrite($balance,0,$n)
Wend

and it don't work. No matter how I try it..... is there any other way I can accomplish this? There is only one page in the help file that deals with mathmatical numbers and it don't give any real working solutions for a project.

Thanks again for all who put up with my same question over and over.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...