myspacee Posted November 11, 2008 Posted November 11, 2008 hello to all,find usefull script that control over mouse over buttons.Set colour working, but want that the button return to 'windows system' colour when mouse left it, is possible ?see _ControlHover() post here downloadexpandcollapse popup#include <GUIConstants.au3> #include <_ControlHover.au3> $Btn_Color = 0x7A9DD8 $Hover_Color = 0xFF0000;0x7AC5D8 $mygui = GUICreate("My GUI - Button Release & colors") $Button_1 = GUICtrlCreateButton("Button1", 0, 0, 100, 100, 0) $Button_2 = GUICtrlCreateButton("Button2", 100, 0, 100, 100, 0) $Button_3 = GUICtrlCreateButton("Button3", 200, 0, 100, 100, 0) $Button_4 = GUICtrlCreateButton("Button4", 0, 100, 100, 100, 0) $Button_5 = GUICtrlCreateButton("Button_OK", 100, 100, 100, 100, 0) $Button_6 = GUICtrlCreateButton("Button6", 200, 100, 100, 100, 0) $Button_7 = GUICtrlCreateButton("Button7", 0, 200, 100, 100, 0) $Button_8 = GUICtrlCreateButton("Button8", 100, 200, 100, 100, 0) $Button_9 = GUICtrlCreateButton("Button9", 200, 200, 100, 100, 0) GUISetState () _ControlHover(2, "", $Button_1) _ControlHover(2, "", $Button_2) _ControlHover(2, "", $Button_3) _ControlHover(2, "", $Button_4) _ControlHover(2, "", $Button_5) _ControlHover(2, "", $Button_6) _ControlHover(2, "", $Button_7) _ControlHover(2, "", $Button_8) _ControlHover(2, "", $Button_9) WinSetTitle($mygui, "", "My GUI - Setting Data & Colors ") While 1 $msg1 = GUIGetMsg() If $msg1 = $GUI_EVENT_CLOSE Then ExitLoop EndIf $Over = _ControlHover(0, $mygui); or _ControlHover() - or _ControlHover(0) If $Over = 1 Then $tempID = @extended GUICtrlSetBkColor( $tempID, $Hover_Color); color does not work on buttons - an Autoit Limit Else $tempID = @extended GUICtrlSetBkColor( $tempID, $Btn_Color ) EndIf $Click = _ControlHover(1, $mygui); or _ControlHover(1) If $Click = 1 And @extended = $Button_1 Then MsgBox(0, 'Testing', 'Button 1 was pressed', 2) If $Click = 1 And @extended = $Button_2 Then MsgBox(0, 'Testing', 'Button 2 was pressed', 2) If $Click = 1 And @extended = $Button_3 Then MsgBox(0, 'Testing', 'Button 3 was pressed', 2) If $Click = 1 And @extended = $Button_4 Then MsgBox(0, 'Testing', 'Button 4 was pressed', 2) If $Click = 1 And @extended = $Button_5 Then MsgBox(0, 'Testing', 'Button 5 was pressed', 2) If $Click = 1 And @extended = $Button_6 Then MsgBox(0, 'Testing', 'Button 6 was pressed', 2) If $Click = 1 And @extended = $Button_7 Then MsgBox(0, 'Testing', 'Button 7 was pressed', 2) If $Click = 1 And @extended = $Button_8 Then MsgBox(0, 'Testing', 'Button 8 was pressed', 2) If $Click = 1 And @extended = $Button_9 Then MsgBox(0, 'Testing', 'Button 9 was pressed', 2) Wendthank you for help,m.
ludocus Posted November 11, 2008 Posted November 11, 2008 Use:http://www.autoitscript.com/forum/index.php?showtopic=55120
myspacee Posted November 11, 2008 Author Posted November 11, 2008 thank you for reply but i post same link... can anyone help me ? thank you! m.
Valuater Posted November 11, 2008 Posted November 11, 2008 That seems to be a problem and this too ... it just changes the text color, but the button color suffers too expandcollapse popup#include <GUIConstants.au3> #include <_ControlHover.au3> $Btn_Color = 0x7A9DD8; 0x7A9DD8 $Hover_Color = 0xFF0000;0x7AC5D8 $mygui = GUICreate("My GUI - Button Release & colors") $Button_1 = GUICtrlCreateButton("Button1", 0, 0, 100, 100, 0) $Button_2 = GUICtrlCreateButton("Button2", 100, 0, 100, 100, 0) $Button_3 = GUICtrlCreateButton("Button3", 200, 0, 100, 100, 0) $Button_4 = GUICtrlCreateButton("Button4", 0, 100, 100, 100, 0) $Button_5 = GUICtrlCreateButton("Button_OK", 100, 100, 100, 100, 0) $Button_6 = GUICtrlCreateButton("Button6", 200, 100, 100, 100, 0) $Button_7 = GUICtrlCreateButton("Button7", 0, 200, 100, 100, 0) $Button_8 = GUICtrlCreateButton("Button8", 100, 200, 100, 100, 0) $Button_9 = GUICtrlCreateButton("Button9", 200, 200, 100, 100, 0) GUISetState() _ControlHover(2, "", $Button_1) _ControlHover(2, "", $Button_2) _ControlHover(2, "", $Button_3) _ControlHover(2, "", $Button_4) _ControlHover(2, "", $Button_5) _ControlHover(2, "", $Button_6) _ControlHover(2, "", $Button_7) _ControlHover(2, "", $Button_8) _ControlHover(2, "", $Button_9) While 1 $msg1 = GUIGetMsg() If $msg1 = $GUI_EVENT_CLOSE Then ExitLoop EndIf $Over = _ControlHover(0, $mygui); or _ControlHover() - or _ControlHover(0) If $Over = 1 Then $tempID = @extended GUICtrlSetColor($tempID, $Hover_Color); color does not work on buttons - an Autoit Limit GUICtrlSetFont($tempID, 12, 500) Else $tempID = @extended GUICtrlSetColor($tempID, ""); $Btn_Color ) ; "" = BLACK GUICtrlSetFont($tempID, 9, 100) EndIf $Click = _ControlHover(1, $mygui); or _ControlHover(1) If $Click = 1 And @extended = $Button_1 Then MsgBox(0, 'Testing', 'Button 1 was pressed', 2) If $Click = 1 And @extended = $Button_2 Then MsgBox(0, 'Testing', 'Button 2 was pressed', 2) If $Click = 1 And @extended = $Button_3 Then MsgBox(0, 'Testing', 'Button 3 was pressed', 2) If $Click = 1 And @extended = $Button_4 Then MsgBox(0, 'Testing', 'Button 4 was pressed', 2) If $Click = 1 And @extended = $Button_5 Then MsgBox(0, 'Testing', 'Button 5 was pressed', 2) If $Click = 1 And @extended = $Button_6 Then MsgBox(0, 'Testing', 'Button 6 was pressed', 2) If $Click = 1 And @extended = $Button_7 Then MsgBox(0, 'Testing', 'Button 7 was pressed', 2) If $Click = 1 And @extended = $Button_8 Then MsgBox(0, 'Testing', 'Button 8 was pressed', 2) If $Click = 1 And @extended = $Button_9 Then MsgBox(0, 'Testing', 'Button 9 was pressed', 2) WEnd Possible suggestions are... 1 to color the button at first, then just return it to that color after hoover is over 2 use ButtonHover() with picure buttons... or even EzSkin with skins and pic buttons 8)
taz742 Posted November 25, 2008 Posted November 25, 2008 (edited) I think this one is working as you want !!! Tip is here:Func _GUICtrlButton_SetBackgroundToSystemColor($CtrlhWnd) GUICtrlSetStyle($CtrlhWnd,BitXOR(_GUICtrlGetStyle($CtrlhWnd),0x0000000B));remove colored style EndFunc ;==>_GUICtrlButton_SetBackgroundToSystemColor Func _GUICtrlGetStyle($CtrlhWnd) If Not IsHWnd($CtrlhWnd) Then $CtrlhWnd = GUICtrlGetHandle($CtrlhWnd) Local $a_Style = DllCall("user32.dll", "long", "GetWindowLong", "hwnd", $CtrlhWnd, "int", -16);get existing Style Return $a_Style[0] EndFunc ;==>_GUICtrlGetStyle Edited November 25, 2008 by taz742
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