Jump to content

Still Need Math Help


Recommended Posts

Sorry to say that I am still pulling my hair out over this... and I know it's not your faults that i'm just not grasping the syntax. :whistle: Let's start from scratch with this. 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:

Starting balance minus ( - ) the payment plus ( +) the deposit will ( =) the balance

Thanks again

Link to comment
Share on other sites

It is around what you ask you still need to ajust the button. Perhaps none are needed. working with 102.13

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

I hope that help. Tell me what you need more in the doc.

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...