Jump to content

tooltip when mouse hovers over an icon?


Recommended Posts

i would like to make a tooltip appear when the mouse is over a button, or over a .avi or pretty much anything on a gui, and when the mouse is not over the specific label, or picture or whatever, i want it to dissappear.

i can make a tooltip but im not sure how to make it appear when the mouse hovers over a control or something on the gui and then dissappear when the mouse is no longer there..

Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.

Link to comment
Share on other sites

ty!

edit: why is it when i make a list in gui, then i hover over it the tooltip is working fine, but when i click the list, the tooltip goes away and wont come back..

Edited by t0ddie

Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.

Link to comment
Share on other sites

ty!

<{POST_SNAPBACK}>

Your welcome. :)

edit: why is it when i make a list in gui, then i hover over it the tooltip is working fine, but when i click the list, the tooltip goes away and wont come back.

<{POST_SNAPBACK}>

Thats odd. I can't seem to reproduce the bug.

What AutoIt version are you using?

Under 3.1.1.1 this seems to work fine.

#include <GuiConstants.au3>

GuiCreate("List", 170, 123,(@DesktopWidth-170)/2, (@DesktopHeight-123)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)

$List = GuiCtrlCreateList("Test", 0, 0, 170, 123)
GuiCtrlSetTip($List,"This Is a tooltip")

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
    ;;;
    EndSelect
WEnd
Exit
Edited by SolidSnake
HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code.
Link to comment
Share on other sites

; AutoIt Version: 3.1.0

and it works fine when you click a label

its the list... thats creating the problem.

$mylist = GUICtrlCreateList("", 305, 139, 200, 173, BitOR($WS_BORDER, $WS_VSCROLL, $LBS_NOSEL, $ES_AUTOVSCROLL, $WS_EX_WINDOWEDGE))

i click that list, the tooltip dissappears just like when you click a label.

but it doesnt come back when you move the mouse back over it, and it will with the label.

just not the list.

and why bitor'ed?

Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.

Link to comment
Share on other sites

; AutoIt Version: 3.1.0

and it works fine when you click a label

its the list... thats creating the problem.

$mylist = GUICtrlCreateList("", 305, 139, 200, 173, BitOR($WS_BORDER, $WS_VSCROLL, $LBS_NOSEL, $ES_AUTOVSCROLL, $WS_EX_WINDOWEDGE))

i click that list, the tooltip dissappears just like when you click a label.

but it doesnt come back when you move the mouse back over it, and it will with the label.

just not the list.

and why bitor'ed?

<{POST_SNAPBACK}>

Maybe it is a weird bug that only occurs with certain scripts.

Could you post the source code of your script?

Thanks -SolidSnake

P.S. Haven't tested but something like this might be a quick fix for your problem.

#include <GuiConstants.au3>

GUICreate("List", 170, 123, (@DesktopWidth - 170) / 2, (@DesktopHeight - 123) / 2, $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)

$List = GUICtrlCreateList("Test", 0, 0, 170, 123)
GUICtrlSetTip($List, "This Is a tooltip")

GUISetState()
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $List
            GUICtrlSetTip($List, "This Is a tooltip")
        Case Else
        ;;;
    EndSelect
WEnd
Exit
Edited by SolidSnake
HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code.
Link to comment
Share on other sites

offtopic but shouldnt styles be BitOr'd ?

<{POST_SNAPBACK}>

If you want to add a new style to an already existing control then it's necessary to BitOR() it so as not to lose the existing style settings. When initially setting them up this isn't necessary because the specified styles are guaranteed not to be set.
Link to comment
Share on other sites

#include <GUIConstants.au3>

GUICreate("My GUI control tip") ; will create a dialog box that when displayed is centered

GUICtrlCreateLabel ("my label", 10,20)
GUICtrlSetTip(-1,"click here, and move mouse and i'll be back!")
                
                $mylist = GUICtrlCreateList("", 200, 200, 100, 100, BitOR($WS_BORDER, $WS_VSCROLL, $LBS_NOSEL, $ES_AUTOVSCROLL, $WS_EX_WINDOWEDGE))
GUICtrlSetTip(-1,"click me and i wont be coming back!")
GUISetState ()

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
    
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend

Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.

Link to comment
Share on other sites

If you want to add a new style to an already existing control then it's necessary to BitOR() it so as not to lose the existing style settings. When initially setting them up this isn't necessary because the specified styles are guaranteed not to be set.

<{POST_SNAPBACK}>

That is not the correct reason. The styles are binary ops. BitORing preserves any already set bits and sets any new bits that need to be set. No bits are ever reset. Addition may produce a result which causes some bits to be reset. In most cases, this is not a problem. The styles are defined in powers of 2 so that each style corresponds to one bit in a 32 bit unsigned integer. However, there are some meta-styles which are a combination of 2 or more styles bitwise or'd together. If you attempt to add a meta-style and one of the styles it contains, the results will be incorrect. However, bitwise or'ing a meta-style and a style it contains will not reset any bits.

A casual user will not know the difference between one of these meta-styles and a single style. Its very easy to accidentally duplicate at least one of the single styles found within the meta-style. Therefore, its best to always BitOR styles together in case you've made a mistake and are including a style twice or in case you ever add a new style which may already be included in a meta-style.

Note: Meta-style is my term for lack of a better description. In this context, I'm using the term to refer to a style that is composed of two or more other styles combined together to produce a "new" style which is more or less just shorthand notation for common styles.

Link to comment
Share on other sites

However, there are some meta-styles which are a combination of 2 or more styles bitwise or'd together.  If you attempt to add a meta-style and one of the styles it contains, the results will be incorrect.

Thanks for clarifying that, Valik.

While I have in fact used them, I was not consciously aware of 'meta-styles' (such as $GUI_DOCKMENUBAR and $LBS_STANDARD) and had wrongly assumed that all possibilities were powers of 2, and would therefore not interfere with eachother when starting from a style of '0'.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...