1joeyoung Posted December 8, 2011 Share Posted December 8, 2011 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 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 8, 2011 Moderators Share Posted December 8, 2011 1JoeYoung, Welcome to the AutoIt forum. I was thinking this would work with labels and controlsGood guess! 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. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
1joeyoung Posted December 8, 2011 Author Share Posted December 8, 2011 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! Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 8, 2011 Moderators Share Posted December 8, 2011 1joeyoung, My pleasure. You know where we are if you run into any difficulties. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now