Sign in to follow this  
Followers 0
LWC

Show GUICtrlSetTip's tip manually

8 posts in this topic

If, for example, someone leaves a GUICtrlCreateInput empty, I would like that input's tooltip to be displayed when the user clicks a nearby button. Is it possible?

Share this post


Link to post
Share on other sites



LWC,

You could always cheat - like this: :x

#include <GUIConstantsEx.au3>

$hGUI = GUICreate("Test", 500, 500)

$hInput = GUICtrlCreateInput("", 10, 10, 200, 20)
GUICtrlSetTip(-1, "I am the normal ToolTip")

$hButton = GUICtrlCreateButton("Go!", 10, 50, 80, 30)

GUISetState()

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $hButton
            $aGUIPos = WinGetPos($hGUI)
            $aCtrlPos = ControlGetPos($hGUI, "", $hInput)
            ToolTip("I am the other ToolTip", $aGUIPos[0] + $aCtrlPos[0] + 100, $aGUIPos[1] + $aCtrlPos[1] + 30)
            Sleep(1000)
            ToolTip("")
    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._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

It's not only "cheating", but uses tooltip which dissapears based on time rather than movement (like GUICtrlSetTip does). Isn't there a direct way to trigger GUICtrlSetTip?

Share this post


Link to post
Share on other sites

The closest I could find was _GUICtrlEdit_ShowBalloonTip. It might be what you want...

Share this post


Link to post
Share on other sites

LWC,

Not the most gracious reply I have ever seen. :P

Isn't there a direct way to trigger GUICtrlSetTip?

If I knew how to do that I would have told you directly. :x

based on time rather than movement

We could look to see if the cursor was still over the button: :shifty:

#include <GUIConstantsEx.au3>

$hGUI = GUICreate("Test", 500, 500)

$hInput = GUICtrlCreateInput("", 10, 10, 200, 20)
GUICtrlSetTip(-1, "I am the normal ToolTip")

$hButton = GUICtrlCreateButton("Go!", 10, 50, 80, 30)

GUISetState()

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $hButton
            $aGUIPos = WinGetPos($hGUI)
            $aCtrlPos = ControlGetPos($hGUI, "", $hInput)
            ToolTip("I am the other ToolTip", $aGUIPos[0] + $aCtrlPos[0] + 100, $aGUIPos[1] + $aCtrlPos[1] + 30)
            While 1
                $aCInfo = GUIGetCursorInfo()
                If $aCInfo[4] <> $hButton Then ExitLoop
                Sleep(10)
            WEnd
            ToolTip("")
    EndSwitch

WEnd

Any better. :nuke:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

And that is a new record ladies and gentlemen!! :x At 15:21 on the 11th of January 2011 Melba23 managed to quintuple post, improving on the previous record of 3 held by various members. Controversially it came at a time when there were many bugs in the forum, though none of the official adjudicators was available to comment on whether this affected the record breaking feat. Nevertheless, this is surely an event for the history books.

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Sorry all - I only meant to post the one. :x

I suppose I will get accused of trying to bump my post count next! :shifty:

M23

Edit: See, I can do it when the forum lets me! :P

Edited by Melba23

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Ok, one problem after another for this :x This is what I have. $hBtn is a handle NOT a control id... who knows why when both places that use it quite clearly say 'id'.

$tNMHDR = DllStructCreate($tagNMHDR)
DllStructSetData($tNMHDR, "hwndFrom", $hTooltip)
DllStructSetData($tNMHDR, "idFrom", $hBtn)
DllStructSetData($tNMHDR, "code", $TTN_SHOW)

_SendMessage($hBtn, $WM_NOTIFY, $hBtn, DllStructGetPtr($tNMHDR))

Even if I input $hTooltip manually to what it should be, still not luck.

Here's what I was testing on:

#include <StructureConstants.au3>
#include <WindowsConstants.au3>
#include <TooltipConstants.au3>
#include <SendMessage.au3>
#include <WinAPI.au3>

$hGUI = GUICreate("Test Tooltip")

$iBtn = GUICtrlCreateButton("Hover here!", 200, 200, 100, 30)
GUICtrlSetTip(-1, "Boo!")
$hBtn = GUICtrlGetHandle(-1)

$hTest = GUICtrlCreateButton("Test", 100, 100, 100, 30)

GUISetState()

$hTooltip = 0 ; ??????????

While 1
    Switch GUIGetMsg()
        Case -3
            ExitLoop
        Case $hTest
            $tNMHDR = DllStructCreate($tagNMHDR)
            DllStructSetData($tNMHDR, "hwndFrom", $hTooltip)
            DllStructSetData($tNMHDR, "idFrom", $hBtn)
            DllStructSetData($tNMHDR, "code", $TTN_SHOW)

            _SendMessage($hBtn, $WM_NOTIFY, $hBtn, DllStructGetPtr($tNMHDR))
    EndSwitch
WEnd

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
Sign in to follow this  
Followers 0