Makaule Posted April 12, 2010 Posted April 12, 2010 (edited) Hello, all, i have met 1 small problem, AGAIN. So here is my problem... I just want to make a button which image would change abit after pressing it. All was OK, but later i had noticed, that after i press any button once it becomes "selected" (you may see special borders) and if i want to press other button and see same "selection" efect (you cant see special borders), i need to press other buttom 2 times to remove "selection" efect from previous button and use it on 2nd. With 1st button you just change image in button and 2nd one is just a test button, to see what i am talking about. Here is my code, it may be easyer to understand what did i mean: #include <GUIConstantsEx.au3> #include <GuiButton.au3> #include <GuiImageList.au3> Opt("GUIOnEventMode", 1) $RedLight = @ScriptDir & "\Image\RedLight.bmp" $GreenLight = @ScriptDir & "\Image\GreenLight.bmp" GuiCreate("Test",400,400) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") $Button = GUICtrlCreateButton("1", 87, 42, 83, 25) $ButtonList = _GUIImageList_Create(18, 18, 5, 3) _GUIImageList_AddBitmap($ButtonList, $RedLight) _GUICtrlButton_SetImageList($Button, $ButtonList,0,4,1,1,2) GUICtrlSetOnEvent($Button, "_Button1") $Button2 = GUICtrlCreateButton("2", 175, 42, 83, 25) $ButtonList2 = _GUIImageList_Create(18, 18, 5, 3) _GUIImageList_AddBitmap($ButtonList2, $RedLight) _GUICtrlButton_SetImageList($Button2, $ButtonList2,0,4,1,1,2) GUICtrlSetOnEvent($Button2, "_Button2") $data = GuiCtrlCreateInput("sss",10,10) GUISetState(@SW_Show) While 1 sleep(50) WEnd Func _Button1() $ButtonList = _GUIImageList_Create(18, 18, 5, 3) _GUIImageList_AddBitmap($ButtonList, $GreenLight) _GUICtrlButton_SetImageList($Button, $ButtonList,0,4,1,1,2) GuiCtrlSetData($data, "aaaaa") EndFunc Func _Exit() Exit EndFunc Edited April 12, 2010 by Makaule
Moderators Melba23 Posted April 12, 2010 Moderators Posted April 12, 2010 Makaule,If I understand you correctly, I believe your problem will be solved by moving the focus away from the button once you have pressed it. You need to add a line to your _Button1 function like this:GUICtrlSetData($data, "aaaaa") ControlFocus("Test", "", $data)Does that work for you? It certainly changes the behaviour of the buttons for me. 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: Reveal hidden contents 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
Makaule Posted April 12, 2010 Author Posted April 12, 2010 (edited) Thanks, i were looking for something like that, but problem was that i were trying to find it in Buttom Options Thanks, Melba, Problem solved. By The way, its also possible to solve my problem using _GUICtrlButton_SetFocus Edited April 12, 2010 by Makaule
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