Sign in to follow this  
Followers 0
Delta01

GuiCtrlCreateUpDown - Preset values?

5 posts in this topic

#1 ·  Posted (edited)

Hi,

Well, I'm trying to use the GuiCtrlCreateUpDown feature so that it has 3 options, which are words (not numbers)

I get it to start with one of the options, but when I got up or down it goes to a number.

What do I have to do to make it toggle through preset variables, Eg. Car, bike, truck. So, if I press up/down it will toggle between car, bike and truck instead of numbers.

Thanks

EDIT: My script is..

;globals
#include <GuiConstants.au3>

Global $Paused
;hotkeys
HotKeySet("{F5}", "TogglePause")
HotKeySet("{F6}", "Terminate")

;Gui creation
$main = GuiCreate("w/e", 300, 350)
$Help = GuiCtrlCreateMenu("&Help")
$About = GuiCtrlCreateMenuItem("Help",$Help)
GuiCtrlCreateGroup("input", 5, 5, 270, 350)
GuiCtrlCreateLabel("input", 10, 25)
$Slot1 = GuictrlCreateInput("1", 35, 25, 15, -1, $ES_NUMBER)
GuiCtrlCreateLabel("input", 55, 25)
$input = GUICtrlCreateInput("Toggle", 200, 25, -1, 20)
$updown = GUICtrlCreateUpdown($input)

GuiSetState(@SW_SHOW)

While 1
    sleep(50)
    Wend

Func Terminate()
    Exit
EndFunc

Func TogglePause()
$Paused = Not $Paused
While $Paused
Sleep(50)
ToolTip("Press F5 to resume",0,0)
WEnd
ToolTip("")
EndFunc
Edited by Delta01

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

OOOOPpppssss!!!... i set it up with numbers.... time for bed lol

;globals
#include <GuiConstants.au3>

Global $Paused
;hotkeys
HotKeySet("{F5}", "TogglePause")
HotKeySet("{F6}", "Terminate")

;Gui creation
$main = GuiCreate("w/e", 300, 350)
$Help = GuiCtrlCreateMenu("&Help")
$About = GuiCtrlCreateMenuItem("Help",$Help)
GuiCtrlCreateGroup("input", 5, 5, 270, 350)
GuiCtrlCreateLabel("input", 10, 25)
$Slot1 = GuictrlCreateInput("1", 35, 25, 15, -1, $ES_NUMBER)
GuiCtrlCreateLabel("input", 55, 25)
$input = GUICtrlCreateInput("4", 200, 25, -1, 20)
$updown = GUICtrlCreateUpdown($input)
GUICtrlSetLimit($updown, 7, 2)

GuiSetState(@SW_SHOW)

While 1
    $msg = GUIGetMsg()
    
    If $msg = -3 Then Exit
    
Wend

Func Terminate()
    Exit
EndFunc

Func TogglePause()
$Paused = Not $Paused
While $Paused
Sleep(50)
ToolTip("Press F5 to resume",0,0)
WEnd
ToolTip("")
EndFunc

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

Lol. So, does anybody know how to use words?

Eg. Car, bike, truck

Share this post


Link to post
Share on other sites

Nobody knows? = \

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Hi,

#include <GuiConstants.au3>

Opt("GUIOnEventMode", 1) 

Global $main, $label, $input, $updown

$main = GuiCreate("UpDown Alphabet ;-)", 250, 40)
$label = GUICtrlCreateLabel("A", 11, 11, 21, 18, $SS_CENTER + $BS_CENTER)
GUICtrlSetBkColor(-1, 0xffffff)
$input = GUICtrlCreateInput("1", 10, 10, 40, 20, $ES_READONLY + $WS_CLIPSIBLINGS)
$updown = GUICtrlCreateUpdown($input)
GUICtrlSetOnEvent($updown, "UpDown")
GUISetOnEvent($GUI_EVENT_CLOSE, "Terminate", $main)
GuiSetState(@SW_SHOW, $main)

While 1
    Sleep(50)
Wend

Func UpDown()
    Dim $aSA = StringSplit("A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z", "|")
    If StringLeft(GUICtrlRead($input), 1) = "-" Or GUICtrlRead($input) = 0 Then 
        GuiCtrlSetData($input, "26")
    ElseIf GUICtrlRead($input) > $aSA[0] Then 
        GuiCtrlSetData($input, "1")
    EndIf   
    GuiCtrlSetData($label, $aSA[GUICtrlRead($input)])
EndFunc

Func Terminate()
    Exit
EndFunc

Cheers

Edited by smashly

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