Cdma1X Posted October 14, 2008 Share Posted October 14, 2008 (edited) hi, i want to change the background color of a Group when cursor is over it.similar to GuiCtrlSetCursor() but a bit different.in this case i want to change color not cursor.i think this image can show the difference and example of what i want.you can see that one group[1] have no background color but another[2] one have.i just want that when the cursor will come over a group then it should change it's background color as in the test image.can you help me?Thanks.Edit: Updated image link Edited October 14, 2008 by Cdma1X Link to comment Share on other sites More sharing options...
AlmarM Posted October 14, 2008 Share Posted October 14, 2008 (edited) Hmmm, mayby you soould take a look at ControlFocus and ControlGetFocus. Some rough thoughts: If ControlGetFocus("[TITLE:Test;CLASS:Group2]") = True Then GUICtrlSetBkColor() AlmarM Edited October 14, 2008 by AlmarM Minesweeper A minesweeper game created in autoit, source available. _Mouse_UDF An UDF for registering functions to mouse events, made in pure autoit. 2D Hitbox Editor A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes. Link to comment Share on other sites More sharing options...
Mojo Posted October 14, 2008 Share Posted October 14, 2008 Hmmm, mayby you soould take a look at ControlFocus and ControlGetFocus. Some rough thoughts: If ControlGetFocus("[TITLE:Test;CLASS:Group2]") = True Then GUICtrlSetBkColor() AlmarM I think it gets the focus only when you click an item in that group, not by hovering over it, but I'm not 100% sure. Definitely a Nice2Have if it's possible somehow. You can fool some of the people all of the time, and all of the people some of the time, but you can not fool all of the people all of the time. Abraham Lincoln - http://www.ae911truth.org/ - http://www.freedocumentaries.org/ Link to comment Share on other sites More sharing options...
AlmarM Posted October 14, 2008 Share Posted October 14, 2008 Yeah, thought the same. Realy nice if anyone could make this work AlmarM Minesweeper A minesweeper game created in autoit, source available. _Mouse_UDF An UDF for registering functions to mouse events, made in pure autoit. 2D Hitbox Editor A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes. Link to comment Share on other sites More sharing options...
martin Posted October 14, 2008 Share Posted October 14, 2008 Yeah, thought the same. Realy nice if anyone could make this work AlmarMYou could easily have a yellow border around the group instead of a yellow background by setting a large label to be visible or not. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
Cdma1X Posted October 14, 2008 Author Share Posted October 14, 2008 You could easily have a yellow border around the group instead of a yellow background by setting a large label to be visible or not.i could not understand it correctly can you explain more and provide a example?Thanks. Link to comment Share on other sites More sharing options...
ProgAndy Posted October 14, 2008 Share Posted October 14, 2008 Should it be sth like this? #include <WinApi.au3> #include <GUIconstants.au3> GUICreate("") $lbl = GUICtrlCreateLabel("",10,10,200,200) GUICtrlSetBkColor(-1,0xffff00) GUICtrlSetState(-1,$GUI_HIDE+$GUI_DISABLE) GUICtrlCreateButton("FRF",30,30) GUICtrlCreateGroup("hhh",10,10,200,200) GUISetState() While 1 Sleep(50) $rect = _WinAPI_GetWindowRect(GUICtrlGetHandle($lbl)) $pos = _WinAPI_GetMousePos() ConsoleWrite("!!" & @CRLF) If _WinAPI_PtInRect($rect,$pos) Then If BitAND(GUICtrlGetState($lbl),$GUI_HIDE) Then GUICtrlSetState($lbl,$GUI_SHOW) Else If BitAND(GUICtrlGetState($lbl),$GUI_SHOW) Then GUICtrlSetState($lbl,$GUI_HIDE) EndIf WEnd *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
Mojo Posted October 14, 2008 Share Posted October 14, 2008 Should it be sth like this? #include <WinApi.au3> #include <GUIconstants.au3> GUICreate("") $lbl = GUICtrlCreateLabel("",10,10,200,200) GUICtrlSetBkColor(-1,0xffff00) GUICtrlSetState(-1,$GUI_HIDE+$GUI_DISABLE) GUICtrlCreateButton("FRF",30,30) GUICtrlCreateGroup("hhh",10,10,200,200) GUISetState() While 1 Sleep(50) $rect = _WinAPI_GetWindowRect(GUICtrlGetHandle($lbl)) $pos = _WinAPI_GetMousePos() ConsoleWrite("!!" & @CRLF) If _WinAPI_PtInRect($rect,$pos) Then If BitAND(GUICtrlGetState($lbl),$GUI_HIDE) Then GUICtrlSetState($lbl,$GUI_SHOW) Else If BitAND(GUICtrlGetState($lbl),$GUI_SHOW) Then GUICtrlSetState($lbl,$GUI_HIDE) EndIf WEnd Exactly!! Awesome, thanks mate! You can fool some of the people all of the time, and all of the people some of the time, but you can not fool all of the people all of the time. Abraham Lincoln - http://www.ae911truth.org/ - http://www.freedocumentaries.org/ Link to comment Share on other sites More sharing options...
martin Posted October 14, 2008 Share Posted October 14, 2008 Should it be sth like this? #include <WinApi.au3> #include <GUIconstants.au3> GUICreate("") $lbl = GUICtrlCreateLabel("",10,10,200,200) GUICtrlSetBkColor(-1,0xffff00) GUICtrlSetState(-1,$GUI_HIDE+$GUI_DISABLE) GUICtrlCreateButton("FRF",30,30) GUICtrlCreateGroup("hhh",10,10,200,200) GUISetState() While 1 Sleep(50) $rect = _WinAPI_GetWindowRect(GUICtrlGetHandle($lbl)) $pos = _WinAPI_GetMousePos() ConsoleWrite("!!" & @CRLF) If _WinAPI_PtInRect($rect,$pos) Then If BitAND(GUICtrlGetState($lbl),$GUI_HIDE) Then GUICtrlSetState($lbl,$GUI_SHOW) Else If BitAND(GUICtrlGetState($lbl),$GUI_SHOW) Then GUICtrlSetState($lbl,$GUI_HIDE) EndIf WEnd That works very nicely. You could have the group caption background change as well. #include <WinApi.au3> #include <GUIconstants.au3> #include <StaticConstants.au3> GUICreate("") $lbl = GUICtrlCreateLabel("", 10, 10, 200, 200) GUICtrlSetBkColor(-1, 0xffff00) GUICtrlSetState(-1, $GUI_HIDE + $GUI_DISABLE) GUICtrlCreateButton("FRF", 30, 30) $group1 = GUICtrlCreateGroup("hhh", 10, 10, 200, 200) GUISetState() $bkcol = PixelGetColor(4, 30) While 1 Sleep(50) $rect = _WinAPI_GetWindowRect(GUICtrlGetHandle($lbl)) $pos = _WinAPI_GetMousePos() ;ConsoleWrite("!!" & @CRLF) If _WinAPI_PtInRect($rect, $pos) Then If BitAND(GUICtrlGetState($lbl), $GUI_HIDE) Then GUICtrlSetState($lbl, $GUI_SHOW) GUICtrlSetBkColor($group1, 0xffff00) EndIf Else If BitAND(GUICtrlGetState($lbl), $GUI_SHOW) Then GUICtrlSetState($lbl, $GUI_HIDE) GUICtrlSetBkColor($group1, $bkcol) EndIf EndIf WEnd Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
Cdma1X Posted October 15, 2008 Author Share Posted October 15, 2008 @ ProgAndy@ martinthanks, can i use a image in background of a group instead of Label? Link to comment Share on other sites More sharing options...
martin Posted October 15, 2008 Share Posted October 15, 2008 @ ProgAndy@ martinthanks, can i use a image in background of a group instead of Label?Use $lbl = GuiCtrlCreatePic(....Make sure you still disable it. Actually the state settings should be GUICtrlSetState($lbl, $GUI_HIDE)andGUICtrlSetState($lbl, BitOr( $GUI_SHOW, $GUI_DISABLE)) Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. 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