Minikori Posted October 10, 2008 Share Posted October 10, 2008 (edited) I'm trying to make it so that when the user's mouse goes over a control it highlights it. This is what I have, but it won't unhighlight the control once the mouse leaves it. Here's what I have: While 1 $msg = GUIGetMsg() $cur = GUIGetCursorInfo() GUICtrlSetBkColor($cur[4], 0xFF0000) ;More code... WEnd Any help? Edited October 11, 2008 by Minikori For those who are asking questions, look in the help file first. I'm tired of people asking stupid questions about how to do things when 10 seconds in the help file could solve their problem.[quote name='JRowe' date='24 January 2010 - 05:58 PM' timestamp='1264381100' post='766337'][quote name='beerman' date='24 January 2010 - 03:28 PM' timestamp='1264372082' post='766300']They already have a punishment system for abuse.[/quote]... and his his name is Valik.[/quote]www.minikori.com Link to comment Share on other sites More sharing options...
Pain Posted October 10, 2008 Share Posted October 10, 2008 (edited) Take a look at this one and see if it helps.http://www.autoitscript.com/forum/index.php?showtopic=33230 Edited October 10, 2008 by Pain Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted October 10, 2008 Share Posted October 10, 2008 There is also GUICtrlSetOnHover_UDF.au3, it is very good, that's what i use in EMP. .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
Minikori Posted October 10, 2008 Author Share Posted October 10, 2008 Take a look at this one and see if it helps.http://www.autoitscript.com/forum/index.php?showtopic=33230This would work, but I have over 100 controls, it would be too much code. Something else or a short example would be nice. For those who are asking questions, look in the help file first. I'm tired of people asking stupid questions about how to do things when 10 seconds in the help file could solve their problem.[quote name='JRowe' date='24 January 2010 - 05:58 PM' timestamp='1264381100' post='766337'][quote name='beerman' date='24 January 2010 - 03:28 PM' timestamp='1264372082' post='766300']They already have a punishment system for abuse.[/quote]... and his his name is Valik.[/quote]www.minikori.com Link to comment Share on other sites More sharing options...
martin Posted October 10, 2008 Share Posted October 10, 2008 (edited) This would work, but I have over 100 controls, it would be too much code. Something else or a short example would be nice.Perhaps something like this. #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 633, 447, 193, 125) $Button1 = GUICtrlCreateButton("Button1", 120, 104, 75, 25, 0) $Button2 = GUICtrlCreateButton("Button2", 320, 136, 75, 25, 0) $Button3 = GUICtrlCreateButton("Button3", 168, 280, 75, 25, 0) $Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 240, 24, 97, 17) $Radio1 = GUICtrlCreateRadio("Radio1", 416, 48, 113, 17) $Input1 = GUICtrlCreateInput("Input1", 48, 16, 121, 21) $Label1 = GUICtrlCreateLabel("", -72, -168, 36, 17, BitOr($WS_BORDER,$WS_CLIPSIBLINGS));, BitOR($WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE)) GUICtrlSetBkColor(-1,0xffffaa) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### $lastOver = 0 While 1 $msg = GUIGetMsg() $cur = GUIGetCursorInfo() If IsArray($cur) Then ConsoleWrite($cur[4] & @CRLF) If $cur[4] <> $lastOver and $cur[4] <> $label1 and $cur[4] <> 0 Then $cp = controlgetpos($Form1,"",$cur[4]) controlmove($Form1,"",$label1,$cp[0] - 4,$cp[1] - 4,$cp[2] + 8,$cp[3]+8) GUICtrlSetState($cur[4],$GUI_FOCUS) $lastOver = $cur[4] EndIf EndIf if $msg = -3 then exit ;More code... WEnd Edited October 10, 2008 by martin 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...
Minikori Posted October 11, 2008 Author Share Posted October 11, 2008 Perhaps something like this. #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 633, 447, 193, 125) $Button1 = GUICtrlCreateButton("Button1", 120, 104, 75, 25, 0) $Button2 = GUICtrlCreateButton("Button2", 320, 136, 75, 25, 0) $Button3 = GUICtrlCreateButton("Button3", 168, 280, 75, 25, 0) $Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 240, 24, 97, 17) $Radio1 = GUICtrlCreateRadio("Radio1", 416, 48, 113, 17) $Input1 = GUICtrlCreateInput("Input1", 48, 16, 121, 21) $Label1 = GUICtrlCreateLabel("", -72, -168, 36, 17, BitOr($WS_BORDER,$WS_CLIPSIBLINGS));, BitOR($WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE)) GUICtrlSetBkColor(-1,0xffffaa) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### $lastOver = 0 While 1 $msg = GUIGetMsg() $cur = GUIGetCursorInfo() If IsArray($cur) Then ConsoleWrite($cur[4] & @CRLF) If $cur[4] <> $lastOver and $cur[4] <> $label1 and $cur[4] <> 0 Then $cp = controlgetpos($Form1,"",$cur[4]) controlmove($Form1,"",$label1,$cp[0] - 4,$cp[1] - 4,$cp[2] + 8,$cp[3]+8) GUICtrlSetState($cur[4],$GUI_FOCUS) $lastOver = $cur[4] EndIf EndIf if $msg = -3 then exit ;More code... WEndOk. This works, but like I said; I have over 100 controls, it would be too much code. For those who are asking questions, look in the help file first. I'm tired of people asking stupid questions about how to do things when 10 seconds in the help file could solve their problem.[quote name='JRowe' date='24 January 2010 - 05:58 PM' timestamp='1264381100' post='766337'][quote name='beerman' date='24 January 2010 - 03:28 PM' timestamp='1264372082' post='766300']They already have a punishment system for abuse.[/quote]... and his his name is Valik.[/quote]www.minikori.com Link to comment Share on other sites More sharing options...
Minikori Posted October 11, 2008 Author Share Posted October 11, 2008 Ok I edited your code and made it work, thanks. For those who are asking questions, look in the help file first. I'm tired of people asking stupid questions about how to do things when 10 seconds in the help file could solve their problem.[quote name='JRowe' date='24 January 2010 - 05:58 PM' timestamp='1264381100' post='766337'][quote name='beerman' date='24 January 2010 - 03:28 PM' timestamp='1264372082' post='766300']They already have a punishment system for abuse.[/quote]... and his his name is Valik.[/quote]www.minikori.com Link to comment Share on other sites More sharing options...
MrCreatoR Posted October 11, 2008 Share Posted October 11, 2008 As suggested by @AdmiralAlkex, you can also use GUICtrlSetOnHover, it will be much easier:expandcollapse popup#include <GuiCtrlSetOnHover_UDF.au3> Opt("GuiOnEventMode", 1) $Btn_Color = 0x7A9DD8 $Hover_Color = 0xFF0000 ;0x7AC5D8 $GUIMain = GUICreate("GuiCtrlSetOnHover - Letters Demo", 570, 200) GUISetOnEvent(-3, "Quit") GUICtrlCreateLetters(10, 60, 18, 20) GUICtrlCreateButton("Close", 30, 120, 100, 30) GUICtrlSetOnEvent(-1, "Quit") GUICtrlSetFont(GUICtrlCreateLabel("Letter: ", 35, 170, 200, 20), 9, 800) $Status_Label = GUICtrlCreateLabel("", 80, 171, 200, 20) GUICtrlSetColor(-1, 0xFF0000) GUICtrlSetFont(-1, 8.5, 800) GUISetState() While 1 Sleep(100) WEnd Func GUICtrlCreateLetters($iLeft, $Top, $Width=15, $Height=15) Local $iLeft_Begin = $iLeft Local $iAsc_Char = 64 For $i = 0 To 25 $iLeft_Begin += 20 $iAsc_Char += 1 GUICtrlCreateButton(Chr($iAsc_Char), $iLeft_Begin, $Top, $Width, $Height) GUICtrlSetOnEvent(-1, "LetterEvents") GUICtrlSetOnHover(-1, "Hover_Func", "Leave_Hover_Func") GUICtrlSetBkColor(-1, $Btn_Color) GUICtrlSetFont(-1, 6) Next EndFunc Func LetterEvents() MsgBox(64, "Pressed", "Letter = " & GUICtrlRead(@GUI_CtrlId)) EndFunc Func Hover_Func($CtrlID) GUICtrlSetBkColor($CtrlID, $Hover_Color) GUICtrlSetData($Status_Label, GUICtrlRead($CtrlID)) Beep(1000, 20) EndFunc Func Leave_Hover_Func($CtrlID) GUICtrlSetBkColor($CtrlID, $Btn_Color) GUICtrlSetData($Status_Label, "") EndFunc Func Quit() Exit EndFunc Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
Minikori Posted October 11, 2008 Author Share Posted October 11, 2008 Thanks, but I'd prefer to do what I have because it doesn't require a UDF for the source. For those who are asking questions, look in the help file first. I'm tired of people asking stupid questions about how to do things when 10 seconds in the help file could solve their problem.[quote name='JRowe' date='24 January 2010 - 05:58 PM' timestamp='1264381100' post='766337'][quote name='beerman' date='24 January 2010 - 03:28 PM' timestamp='1264372082' post='766300']They already have a punishment system for abuse.[/quote]... and his his name is Valik.[/quote]www.minikori.com 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