Jump to content

Autoit GUICtrlCreateUpdown


Recommended Posts

Hello :mellow:

In this script down is suppose to remain at 10 which it does but what I want to do is when I push up it will go all the way up to 20 and every time I push up $Limit gets -1.

However if I push down it goes back up +1

So for example

10 is the min

20 is the max

So 15 would be Input 15 and $Limit would = 5

If that makes sense, basically $Limit represents how many times you can go up or down

Input = 20 , $Limit = 0

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
 
$GUI = GUICreate("")
$Limit = GUICtrlCreateLabel("10" , 0, 100, 100, 20)
 
$Stat = GUICtrlCreateInput("10", 0, 0, 50, 20)
$Level = GUICtrlCreateUpdown($Stat)
GUICtrlSetLimit($Level, GUICtrlRead($Stat) + GUICtrlRead($Limit), GUICtrlRead($Stat) + GUICtrlRead($Limit) - GUICtrlRead($Limit))
GUISetState(@SW_SHOW)
 
While 1
    $Msg = GUIGetMsg()
    Switch $Msg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
    ToolTip(GUICtrlRead($Stat) , 0,0)
WEnd
Edited by SkellySoul
Link to comment
Share on other sites

Something like this?

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$GUI = GUICreate("")
$Limit = GUICtrlCreateLabel("10" , 0, 100, 100, 20)
$Stat = GUICtrlCreateInput("10", 0, 0, 50, 20)
$Level = GUICtrlCreateUpdown($Stat)
GUICtrlSetLimit($Level, 20, 10)
GUISetState(@SW_SHOW)
$CurrentLimit = GUICtrlRead($Stat)
While 1
    $Msg = GUIGetMsg()
    Switch $Msg
        Case $GUI_EVENT_CLOSE
            Exit
 EndSwitch
 If $CurrentLimit <> GUICtrlRead($Stat) Then
  GUICtrlSetData($Limit, 20-GUICtrlRead($Stat))
  $CurrentLimit = GUICtrlRead($Stat)
 EndIf
WEnd
Link to comment
Share on other sites

Something like this?

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$GUI = GUICreate("")
$Limit = GUICtrlCreateLabel("10" , 0, 100, 100, 20)
$Stat = GUICtrlCreateInput("10", 0, 0, 50, 20)
$Level = GUICtrlCreateUpdown($Stat)
GUICtrlSetLimit($Level, 20, 10)
GUISetState(@SW_SHOW)
$CurrentLimit = GUICtrlRead($Stat)
While 1
    $Msg = GUIGetMsg()
    Switch $Msg
        Case $GUI_EVENT_CLOSE
            Exit
EndSwitch
If $CurrentLimit <> GUICtrlRead($Stat) Then
  GUICtrlSetData($Limit, 20-GUICtrlRead($Stat))
  $CurrentLimit = GUICtrlRead($Stat)
EndIf
WEnd

Yes, thank you :mellow:

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...