shamike Posted August 4, 2012 Share Posted August 4, 2012 here how to make button change colour button,backgorund,hide button and disable button here the exampleexpandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Global Const $AC_SRC_ALPHA = 1 #Region ### START Koda GUI section ### Form= $Form1 = GUICreate(-1, 330, 323, 0, 0,$WS_Popup) GUISetFont(10, 800, 0, "MS Sans Serif") $Button1 = GUICtrlCreateButton("Green", 8, 8, 153, 49) GUICtrlSetBkColor(-1, 0x00FF00) $Button2 = GUICtrlCreateButton("Red", 8, 64, 153, 49) GUICtrlSetBkColor(-1, 0xFF0000) $Button3 = GUICtrlCreateButton("Blue", 168, 8, 153, 49) GUICtrlSetBkColor(-1, 0x0000FF) $Button4 = GUICtrlCreateButton("Yellow", 168, 64, 153, 49) GUICtrlSetBkColor(-1, 0xFFFF00) $Button5 = GUICtrlCreateButton("Purple", 8, 120, 153, 49) GUICtrlSetBkColor(-1, 0xFF00FF) $Button6 = GUICtrlCreateButton("Aqua", 168, 120, 153, 49) GUICtrlSetBkColor(-1, 0x00FFFF) $Button7 = GUICtrlCreateButton("Exit", 8, 169, 313, 50) $Button8 = GUICtrlCreateButton("Show", 8, 219, 153, 50) $Button9 = GUICtrlCreateButton("Hide", 168, 219, 153, 50) $Button10 = GUICtrlCreateButton("Enable", 8, 269, 153, 50) $Button11 = GUICtrlCreateButton("Disable", 168, 269, 153, 50) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Form1 Case $Form1 Case $Form1 Case $Form1 Case $Button1 GUISetBkColor(0x00FF00);Set $form1 background colour GUICtrlSetBkColor($Button7,0x00FF00);Set button colour Case $Button2 GUISetBkColor(0xFF0000) GUICtrlSetBkColor($Button7,0xFF0000) Case $Button3 GUISetBkColor(0x0000FF) GUICtrlSetBkColor($Button7,0x0000FF) Case $Button4 GUISetBkColor(0xFFFF00) GUICtrlSetBkColor($Button7,0xFFFF00) Case $Button5 GUISetBkColor(0xFF00FF) GUICtrlSetBkColor($Button7,0xFF00FF) Case $Button6 GUISetBkColor(0x00FFFF) GUICtrlSetBkColor($Button7,0x00FFFF) Case $Button7 Exit Case $Button8 GUICtrlSetState($Button7,$GUI_SHOW);Show button Case $Button9 GUICtrlSetState($Button7,$GUI_Hide);Hide button Case $Button10 GUICtrlSetState($Button7,$GUI_ENABLE);Enable button Case $Button11 GUICtrlSetState($Button7,$GUI_DISABLE);Disable button EndSwitch WEnd to change the background background you need to use this code GUISetBkColor() to change the button colour you need GUICtrlSetBkColor($Button7,0x00FFFF) for show and hide button GUICtrlSetState(Control id,$GUI_SHOW);Show button GUICtrlSetState(Control id,$GUI_HIDE);Hide button for enable and disable button you need GUICtrlSetState(Control id,$GUI_ENABLE);Enable button GUICtrlSetState(Control id,$GUI_DISABLE);Disable button Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted August 4, 2012 Moderators Share Posted August 4, 2012 shamike,Thank you for posting this small tutorial. But I would like to point out that this section of the forum is normally used for more complex AutoIt scripts, rather than explaining what can easily be found in the Help file. If you want to add more tutorials at the same level in the future, then please add them to this thread and do not start a new thread for each one. I will change the title if you wish - perhaps "shamike's tutorials" would be a good idea. 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...
squidol Posted August 4, 2012 Share Posted August 4, 2012 thanks for the tutorial, try using koda gui designer, it will help you design your gui at ease. Link to comment Share on other sites More sharing options...
shamike Posted August 8, 2012 Author Share Posted August 8, 2012 shamike,Thank you for posting this small tutorial. But I would like to point out that this section of the forum is normally used for more complex AutoIt scripts, rather than explaining what can easily be found in the Help file. If you want to add more tutorials at the same level in the future, then please add them to this thread and do not start a new thread for each one. I will change the title if you wish - perhaps "shamike's tutorials" would be a good idea. M23ok i will do it Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted August 8, 2012 Moderators Share Posted August 8, 2012 shamike, Thanks. 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