Ok, here is what i came up with after 3-4 hours of scripting well ok, it has been long time since then, so... after an year or so of hard scripting/testing!!!
(inspired by this topic)...
GUICtrlSetOnHover UDF...
Syntax:
_GUICtrl_OnHoverRegister(ControlID [, OnHoverFunc [, OnLeaveHoverFunc [, PrimaryDownFunc [, PrimaryUpFunc [, KeepCall_PrDn_Func [, KeepCall_Hover_Func]]]]]])
ControlID can be -1 as in Build-In functions!
Example:
#include "GUICtrlOnHover.au3"
Opt("GUIOnEventMode", 1)
$Btn_Color = 0x7A9DD8
$Hover_Color = 0xFF0000 ;0x7AC5D8
$GUIMain = GUICreate("Letters Hovering Example", 570, 200)
GUISetOnEvent(-3, "Quit")
_CreateLetters_Proc(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 _CreateLetters_Proc($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)
_GUICtrl_OnHoverRegister(-1, "_Hover_Func", "_Leave_Hover_Func")
GUICtrlSetOnEvent(-1, "_Letter_Events")
GUICtrlSetBkColor(-1, $Btn_Color)
GUICtrlSetFont(-1, 6)
Next
EndFunc
Func _Letter_Events()
MsgBox(64, "Pressed", "Letter = " & GUICtrlRead(@GUI_CtrlId))
EndFunc
Func _Hover_Func($iCtrlID)
GUICtrlSetBkColor($iCtrlID, $Hover_Color)
GUICtrlSetData($Status_Label, GUICtrlRead($iCtrlID))
Beep(1000, 20)
EndFunc
Func _Leave_Hover_Func($iCtrlID)
GUICtrlSetBkColor($iCtrlID, $Btn_Color)
GUICtrlSetData($Status_Label, "")
EndFunc
Func Quit()
Exit
EndFunc
Attachments:
[The archive include few nice examples, and the UDF itself of course .]
* New (v2.1) (Redirection to Zip-file, 159 kb) _GUICtrlSetOnHover.html
GUICtrlSetOnHover.zip
GUICtrlSetOnHover_UDF.au3
GuiCtrlSetOnHover.zip
GUICtrlSetOnHover_UDF_For_3.2.10.0.au3
Old Beta - GUICtrlSetOnHover_UDF_beta.zip
Enjoy!
P.S
Thanks to piccaso for the greatest CallBack tool! Without it, this UDF would never been created!
============================================
History version: