royalmarine Posted February 25, 2011 Share Posted February 25, 2011 not sure if this is possible, say there is a gui, with a "start" button. when clicked, it does so and so. however, when its clicked, can it be changed to "cancel" and when that is clicked, it cancel's the currently running code, and changes back to "start" etc. i know that autoit can set a button to being disabled, etc but can the button be changed? and then changed back once re-clicked? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 25, 2011 Moderators Share Posted February 25, 2011 royalmarine,Just use GUICtrlSetData - the Help file has all the details. 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...
Miniz Posted February 25, 2011 Share Posted February 25, 2011 GUICreate("Button example", 100, 40) $bButton = GUICtrlCreateButton("Start", 0, 0, 100, 40) GUISetState() $state = 0 While 1 $msg = GUIGetMsg() Switch $msg Case -3 Exit Case $bButton If $state Then $state = 0 GUICtrlSetData($bButton, "Start") Else $state = 1 GUICtrlSetData($bButton, "Cancel") EndIf EndSwitch If $state Then ; Do code EndIf WEnd Link to comment Share on other sites More sharing options...
royalmarine Posted February 25, 2011 Author Share Posted February 25, 2011 GUICreate("Button example", 100, 40) $bButton = GUICtrlCreateButton("Start", 0, 0, 100, 40) GUISetState() $state = 0 While 1 $msg = GUIGetMsg() Switch $msg Case -3 Exit Case $bButton If $state Then $state = 0 GUICtrlSetData($bButton, "Start") Else $state = 1 GUICtrlSetData($bButton, "Cancel") EndIf EndSwitch If $state Then ; Do code EndIf WEnd cheers dude, i was way off... #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("show/hide pic", 326, 288, 192, 124) $Pic1 = GUICtrlCreatePic("", 8, 8, 308, 212, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS)) $Show = GUICtrlCreateButton("show", 96, 240, 123, 41, $WS_GROUP) $Hide = GUICtrlCreateButton("Hide", 96, 240, 123, 41, $WS_GROUP) GUICtrlSetState($Hide, $GUI_DISABLE) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Show GUICtrlSetState($Show, $GUI_DISABLE) GUICtrlSetState($Hide, $GUI_ENABLE) GUICtrlSetData $Pic1 = ('C:\Users\mike\Desktop\pic1.gif') Case $Hide GUICtrlSetState($Hide, $GUI_DISABLE) GUICtrlSetState($Show, $GUI_ENABLE) GUICtrlSetData $Pic1 = ('') EndSwitch WEnd 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