Jump to content

IM A NOOB, SORRY..... (but we all gotta start somewhere)


 Share

Recommended Posts

this is what i would like to.

imput a value in an inputbox,, like 10.

Then everytime i click the go button, it takes 1 off of ten, and displays it in the box till it reaches 0.

(so i will need to click go 10 times.)

Global $Qty_synth

#include <GUIConstants.au3>

$Form1 = GUICreate("AForm1", 150, 200, 900, 150)

$Go = GUICtrlCreateButton("Go!!!", 24, 64, 97, 33)

$Qty_synth = GUICtrlCreateInput(0, 10, 150, 175, 20)

GUISetState()

While 1

$msg = GUIGetMsg()

Select

Case $msg = $Go

$Qty_synth = GUICtrlRead($Qty_synth)

$Qty_synth = $Qty_synth - 1

Case $msg = $GUI_EVENT_CLOSE

ExitLoop

EndSelect

WEnd

This is prolly a piece of cake for you guys

Thanks :D:D

Link to comment
Share on other sites

Welcome to the forums :D

What you should do is whenever the Go button is pressed, store the number somewhere, take 1 from it, then put it back into the input box.

Global $Number

#include <GUIConstants.au3>
$Form1 = GUICreate("AForm1", 150, 200, 900, 150)
$Go = GUICtrlCreateButton("Go!!!", 24, 64, 97, 33)
$Qty_synth = GUICtrlCreateInput(0, 10, 150, 175, 20)

GUISetState()

While 1
$msg = GUIGetMsg()
Select

Case $msg = $Go


$Number = GUICtrlRead($Qty_synth)
If $Number > 0 Then
    $Number = $Number - 1
    GUICtrlSetData($Qty_synth, $Number)
EndIf



Case $msg = $GUI_EVENT_CLOSE
ExitLoop

EndSelect
WEnd

Other than that good job, except it isnt a good idea to use the same variable that holds the handle to the input box to store your number.

Edited by Emperor
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...