Jump to content
MrCreatoR

GUICtrlSetOnHover UDF!

Recommended Posts

martin

Thanks for this udf MrCreatoR, I like it and it's very useful.

Why did you use a timer though rather than use WM_MOUSEMOVE which would mean your function would only get called when there is a need to call it?


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.

Share this post


Link to post
Share on other sites
GEOSoft

Thanks for this udf MrCreatoR, I like it and it's very useful.

Why did you use a timer though rather than use WM_MOUSEMOVE which would mean your function would only get called when there is a need to call it?

Take a look at the date of the original post. I don't think anyone was really making much use of WM_MOUSEMOVE back then.

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!"

Share this post


Link to post
Share on other sites
martin

Take a look at the date of the original post. I don't think anyone was really making much use of WM_MOUSEMOVE back then.

True, at least not GuiRegisterMsg which I was thinking off. Also, to get the WM_MOUSEMOVE over controls you need to sub-class the control as well which was probably even less common.

Maybe I should put it another way. MrCreator, if you are ever at a loss for something to do, maybe changing this udf to use WM_MOUSEMOVE rather than a timer might make it more efficient.


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.

Share this post


Link to post
Share on other sites
AutoBert

Hello MrCreator,

the GUICtrlSetOnHover.zip in Post #1 is damaged. Please load it up again,

thanks (Auto)Bert

Edited by AutoBert

Share this post


Link to post
Share on other sites
froufrou

Just wondering if this is working with AutoIt v3.3.0.0

Share this post


Link to post
Share on other sites
KaFu
froufrou

Well i love this idea but it just doesn't work for me.I can't even get the examples in the zip to work for me.Anybody have an idea what could be the problem?

Share this post


Link to post
Share on other sites
KaFu

Well i love this idea but it just doesn't work for me.I can't even get the examples in the zip to work for me.Anybody have an idea what could be the problem?

In the other thread you mentioned you recently switched to vista... maybe that's the reason? Add a #RequireAdmin to the top of the UDF to see if it's related to UAC.

Or try ProgAndy's update here

#617400

Share this post


Link to post
Share on other sites
froufrou

Thanks for tryin.I had already tried that one too.And I have UAC turned off.What you mentioned was my thoughts as well,that it could be Vista and it's x64 as well.Thanks though.

Share this post


Link to post
Share on other sites
KaFu

...that it could be Vista and it's x64 as well.

Hmm, what happens if you compile it and let it run in the "program files 32" folder :D ?

Share this post


Link to post
Share on other sites
MrCreatoR

Maybe I should put it another way. MrCreator, if you are ever at a loss for something to do, maybe changing this udf to use WM_MOUSEMOVE rather than a timer might make it more efficient.

Sorry for late reply, i lost the subscription for this thread (due to lack of answers here for long time) :D

About the question. Well, i prefer to use timers because of WM_* limitations with unfocused GUI. For now, the hover process is triggered even if the GUI is not focused (active), but still visible to the eye (to mouse pointer actualy :D ). You can not get this behaviour with WM_MOUSEMOVE.

I also could use a mouse hook to prevent unneccessary function calls, but this can cause few problems with mouse clicks and similar events. So timers imo, is the best solution for now.


 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: 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 Program

AutoIt_Icon_small.pngUDFs: 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
 
AutoIt_Icon_small.pngExamples: 
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 AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites
froufrou

Hmm, what happens if you compile it and let it run in the "program files 32" folder :D ?

Well I compiled and ran at "program files 32" and nothing :D .

Am i doing this right? ;)

$CloseBtn = GUICtrlCreatePic($CloseBtn0, $width - 40, 3, 32, 32)
_GUICtrlSetOnHover(-1,"hover","nohover",-1,-1)
GUICtrlSetOnEvent(-1, "close")
GUICtrlSetTip(-1, "Exit", "", 1)

Func hover()
GUICtrlSetImage ( $CloseBtn,$CloseBtn1)
EndFunc  ;==>hover

Func nohover()
GUICtrlSetImage ( $CloseBtn,$CloseBtn0)
EndFunc  ;==>nohover

Share this post


Link to post
Share on other sites
KaFu

Share this post


Link to post
Share on other sites
froufrou

KaFu

OH YEAH!!! :D:D;):P;):D

Compiled example works,I'll go from there. Thank-You,.Thank-You,.Thank-You,.Thank-You,.Thank-You,.Thank-You

I would have gave-up without your replies.

EDIT:

I wanted to add it works in my project too :D:D;):D .

I just needed to compile first.

@everyone

If somewhere in this topic if it stated "must compile first"then just overlook me,i missed it.

Edited by froufrou

Share this post


Link to post
Share on other sites
froufrou

Is there a way to repeat "$sHover_Func" until "$sLeaveHover_Func" is called?

Thanks

Share this post


Link to post
Share on other sites
MrCreatoR

Is there a way to repeat "$sHover_Func" until "$sLeaveHover_Func" is called?

Thanks

Yes, you can try something like this:

#include <GUIConstantsEx.au3>
#include <GUICtrlSetOnHover_UDF.au3>
;

Global $iCounter = 0

$hGUI = GUICreate("Keep Calling Hover_Func Example", 280, 200)

$Hand_Pic = GUICtrlCreateButton("Hover me", 55, 35, 60, 20)
_GUICtrl_SetOnHover(-1, "_Hover_Proc", "_Leave_Hover_Proc")

GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

Func _Hover_Proc($iCtrlID)
    If IsDeclared("iCtrlID") Then
        AdlibEnable("_Hover_Proc", 10)
    Else
        $iCounter += 1
        ConsoleWrite("Hovering... " & $iCounter & @CRLF)
    EndIf
EndFunc

Func _Leave_Hover_Proc($iCtrlID)
    AdlibDisable()
EndFunc

P.S

This exactly behaviour that i was trying to avoid at the begining, but now i think it can be usefull as optional parameter, i will see what i can do about it...

Edited by MrCreatoR

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: 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 Program

AutoIt_Icon_small.pngUDFs: 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
 
AutoIt_Icon_small.pngExamples: 
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 AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites
froufrou

Thank-You I'll see if I can get that to work.

AdlibEnable("_Hover_Proc", 10)
Throws a wrong # of arguments error.

But Thank-You it gives me a place to start looking.and i'll keep trying.And please post if you find a easier way. :D

Share this post


Link to post
Share on other sites
MrCreatoR

UDF update!

History Version:

[v1.6] - [12.06.2009]

* Now the UDF compatible with scripts (or other udfs) that uses OnAutoItExit function.

------i.e: "OnAutoItExit" function that was *previously* set by user will be called as well.

+ Added new parameter $iKeepCall_Hover_Func. If this parameter = 1,

------then the $sHover_Func function *Will* be called constantly untill the control is no longer been hovered

------(default is 0, do not call the function constantly).

+ Added new arguments to calling function...

------The OnPrimaryDown/Up function now can recieve one more argument:

------------------------$iClickMode - Defines the Click mode (1 - Pressed, 2 - Released)

* Changed return value - function will return 2 when $iCtrlID is redefined (ReSet, already exists in the controls list).

* Fixed incorrect documentation parts.

* Fixed "onclick" handeling. When using multiple GUIs, the active gui was not recognized properly.

* Fixed(?) bug with "dimension range exceeded" when trying to UnSet a Control.

Please see the first post.


 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: 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 Program

AutoIt_Icon_small.pngUDFs: 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
 
AutoIt_Icon_small.pngExamples: 
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 AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites
MrCreatoR

Throws a wrong # of arguments error

Replace _Hover_Proc($iCtrlID) with _Hover_Proc($iCtrlID=0).

And see the last changes :D


 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: 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 Program

AutoIt_Icon_small.pngUDFs: 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
 
AutoIt_Icon_small.pngExamples: 
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 AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Share this post


Link to post
Share on other sites
froufrou

@MrCreatoR

Thank-You The new update fixes all my questions,Perfect! :D

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×