Sign in to follow this  
Followers 0
1joeyoung

GUI Windows with Increment/Decrement Buttons

4 posts in this topic

I'm very much a newbie to AutoIt and haven't had any success in searching for what I'm looking for here on the forum, so I've started this topic.

Essentially, I want to have a window that shows a number (starting at 0) with 3 buttons under the number; +1, -1, Reset.

Clicking "+1" would add 1 to the number shown, changing it to "1", "2", etc...

I was thinking this would work with labels and controls, but my brain isn't wrapping around the right way to do it, so I was hoping for some help here.

Thanks for any advice, and I apologize if it's answered elsewhere already!

Joe

Share this post


Link to post
Share on other sites



1JoeYoung,

Welcome to the AutoIt forum. :D

I was thinking this would work with labels and controls

Good guess! :rip:

Perhaps somehting along these lines is what you were thinking of:

#include <GUIConstantsEx.au3>

$hGUI = GUICreate("Test", 500, 500)
GUISetFont(18)

$hLabel = GUICtrlCreateLabel(0, 10, 10, 150, 50)
GUICtrlSetFont(-1, 24)

$hButton_Up = GUICtrlCreateButton("+", 10, 100, 80, 30)
$hButton_Dn = GUICtrlCreateButton("-", 90, 100, 80, 30)
$hButton_Re = GUICtrlCreateButton("0", 170, 100, 80, 30)


GUISetState()

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $hButton_Up
            GUICtrlSetData($hLabel, Number(GUICtrlRead($hLabel)) + 1)
        Case $hButton_Dn
            GUICtrlSetData($hLabel, Number(GUICtrlRead($hLabel)) - 1)
        Case $hButton_Re
            GUICtrlSetData($hLabel, 0)
    EndSwitch

WEnd

Try to understand how it works by looking up the various functions in the Help file. Ask if you have any questions - but not until you have read about the functions first. :oops:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Exactly what I was looking for - Thank you!

Now that I have a good base, I'll start messing with it and adapt it to my end goal.

Thanks a million for the start, M23!

Share this post


Link to post
Share on other sites

1joeyoung,

My pleasure. You know where we are if you run into any difficulties. :D

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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