Sign in to follow this  
Followers 0
rotatorkuf

how to use guictrlsetlimit

4 posts in this topic

Global $inputRuns = GUICtrlCreateInput("3",10, 110, 40,20)
GUICtrlCreateUpdown($inputRuns)
GUICtrlSetLimit($inputRuns, 20, 6)
 
So i want the updown to stop at 20 and 6 for max/min, but whenever i load up the gui/script, it goes past those values.
 
What am I doing wrong?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

rotatorcuff,

GuiCtrlSetLimit needs to reference the updown control.  Try it like this...

#include <GUIConstantsEx.au3>

local $gui010 = guicreate('')
Global $inputRuns = GUICtrlCreateInput("3",10, 110, 40,20)
local $up = GUICtrlCreateUpdown($inputRuns)
GUICtrlSetLimit($up, 20, 6)
guisetstate()

while 1
    switch guigetmsg()
        case $gui_event_close
            Exit
    EndSwitch
WEnd

kylomas

edit: This also works...

#include <GUIConstantsEx.au3>

local $gui010 = guicreate('')
Global $inputRuns = GUICtrlCreateInput("3",10, 110, 40,20)
GUICtrlCreateUpdown($inputRuns)
GUICtrlSetLimit(-1, 20, 6)
guisetstate()

while 1
    switch guigetmsg()
        case $gui_event_close
            Exit
    EndSwitch
WEnd
Edited by kylomas
1 person likes this

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites

 

rotatorcuff,

GuiCtrlSetLimit needs to reference the updown control.  Try it like this...

#include <GUIConstantsEx.au3>

local $gui010 = guicreate('')
Global $inputRuns = GUICtrlCreateInput("3",10, 110, 40,20)
local $up = GUICtrlCreateUpdown($inputRuns)
GUICtrlSetLimit($up, 20, 6)
guisetstate()

while 1
    switch guigetmsg()
        case $gui_event_close
            Exit
    EndSwitch
WEnd

kylomas

edit: This also works...

#include <GUIConstantsEx.au3>

local $gui010 = guicreate('')
Global $inputRuns = GUICtrlCreateInput("3",10, 110, 40,20)
GUICtrlCreateUpdown($inputRuns)
GUICtrlSetLimit(-1, 20, 6)
guisetstate()

while 1
    switch guigetmsg()
        case $gui_event_close
            Exit
    EndSwitch
WEnd

thank you so much, i'm dumb lol

Share this post


Link to post
Share on other sites

No, not dumb, just inexperienced.  Please see my sig for how to post code.

Good luck and Welcome to AutoIt,

kylomas


Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
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
Sign in to follow this  
Followers 0