rCANE Posted October 23, 2009 Share Posted October 23, 2009 hi all!i want a tiny rollover effect but i can't find how so there is a button, no text just with a black and white ico pic.when i move the mouse over change the pic (to the colored one) and when out change to it's original (black and white) pic.thanks Link to comment Share on other sites More sharing options...
dantay9 Posted October 23, 2009 Share Posted October 23, 2009 (edited) You can use MouseGetPos and compare the results with the known position of the button. An easier way would be to use GUIGetCursorInfo. Take a look at the help file for GUIGetCursorInfo and you will find a return value for the button the mouse is over. Here is an example: $GUI = GUICreate("GUI") $Button = GUICtrlCreateButton("BUTTON", 50, 50) GUISetState() While 1 $Msg = GUIGetCursorInfo($GUI) If $Msg[4] = $Button Then ConsoleWrite("ON BUTTON" & @CRLF) ;change the picture on the button While $Msg[4] = $Button $Msg = GUIGetCursorInfo($GUI) Sleep(50) ;ease up on the cpu WEnd ConsoleWrite("OFF BUTTON" & @CRLF) EndIf Sleep(50) ;ease up on the cpu WEnd Edited October 24, 2009 by dantay9 Link to comment Share on other sites More sharing options...
GEOSoft Posted October 24, 2009 Share Posted October 24, 2009 (edited) A method I use is to resize the image by a few pixels on mouseover and back to original size on mouseout. Edit: Another method is to create a copy of the original icon but slightly lighter or darker and then switch the image on mouseover. Edited October 24, 2009 by GEOSoft George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 24, 2009 Moderators Share Posted October 24, 2009 rCANE, This works really nicely - but you need small BMPs rather than .ico files: ; Min Operating Systems: Windows XP #include <GUIConstantsEx.au3> #include <GuiButton.au3> #include <GuiImageList.au3> $hImage_1 = "BMP_1" $hImage_2 = "BMP_2" $hGUI = GUICreate("Button Imagelist - Test",400,300) $hButton = GUICtrlCreateButton("", 30, 30, 32, 32) GUICtrlSetTip(-1, "Multi state bitmap imagelist") $hImage_Button = _GUIImageList_Create(24, 24, 5, 5) _GUIImageList_AddBitmap($hImage_Button, $hImage_1) ;1 - Normal _GUIImageList_AddBitmap($hImage_Button, $hImage_2) ;2 - Hot (ie cursor over) _GUICtrlButton_SetImageList($hButton, $hImage_Button) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd 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...
Yashied Posted October 24, 2009 Share Posted October 24, 2009 (edited) @Melba23_GUIImageList_AddIcon()? Edited October 24, 2009 by Yashied My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 24, 2009 Moderators Share Posted October 24, 2009 Yashied, You are quite correct. My only excuse is that I copied that snippet from a working script which uses BMPs. 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...
rCANE Posted October 24, 2009 Author Share Posted October 24, 2009 thank you guys, i'll try and screech when i have a problem. Link to comment Share on other sites More sharing options...
Datus Posted December 31, 2009 Share Posted December 31, 2009 just to let you know i found this very usefull. ive been using code to check where mouse pointer was and change the icon. this is much better and reduced the complexity of the code i had to do. We live as we dream alone! 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