Timppa

Custom ToolTip

3 posts in this topic

#1 ·  Posted (edited)

Hello! Again a problem encountered :angry:

There's a ToolTip command and I am using it in my script that has over 2500 lines of text. I have like 100+ ToolTip functions so I can check debug easily. However, I made function like this:

Func ToolTipCustom($ToolTipText, $ToolX, $ToolY)
   If $Debug = 1 Then
      ToolTip($ToolTipText,$ToolX, $ToolY)
      Sleep($ToolTipSleep)
 ;Has been set to 1000
   EndIf
EndFunc

This function will pop up the tooltip ONLY if $Debug is 1 so if there's a function i'd use it like this:

Func Example()
    ToolTipCustom("We are in Function Example()")
    Send("Hello Example!")
    Sleep(2000)
    Exit
EndFunc

INSTEAD of this:

Func Example()
    If $Debug = 1 Then
        ToolTip("We are in Function Example()")
        Sleep(1000)
    EndIf
    Send("Hello Example!")
    Sleep(2000)
    Exit
EndFunc

So it would be so much easier to add custom tooltip than 3 additional lines per tooltip.

And now to the problem: I get this error (Incorrect number of parameters in function call)  if I use the ToolTipCustom like this > ToolTipCustom("This is a custom tooltip, 35, 400")

So I cannot enter X and Y, because some tooltips has X and Y and some doesn't (they appear under mouse). So how is this done?

I added $ToolX and $ToolY after the $ToolTipText in Func ToolTipCustom but now it does not work with the tooltips where I haven't defined X and Y...

Other solution is to add $MouseX and $MouseY after the tooltips that has no X and Y defined already, but it'd be annoying to find each tooltip.

 

So what I need is a function that can be used WITH or WITHOUT x and y, if there's like ToolTipCustom("Hi",30,60") it will then pop up tooltip to the 30,60 postion, if it's only ToolTipCustom("Hi") then it will pop up under my mouse.

Oh well and also, it'd be cool if i could ADDITIONALLY add $ToolTipSleep after the X and Y so it would be look like this:

ToolTipCustom("Hi",30,60,1000) ;<- 1 second Sleep

Sorry for very long explanation for simple thing, but I don't want any misunderstandings.

Thanks in advance!

Edited by Timppa

Share this post


Link to post
Share on other sites



Timppa,

Use default values for the function parameters like this:

$bDebug = False

ToolTipCustom("Will not show")

$bDebug = True

ToolTipCustom("Under the mouse")

ToolTipCustom("At 100, 100", 100, 100)

ToolTipCustom("Under the mouse for 5 secs", Default, Default, 5000)


Func ToolTipCustom($sToolTipText, $iToolX = Default, $iToolY = Default, $iToolTipSleep = 1000)
    If $bDebug = True Then
        ToolTip($sToolTipText, $iToolX, $iToolY)
        Sleep($iToolTipSleep)
    EndIf

EndFunc   ;==>ToolTipCustom

M23

1 person likes this

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

Okay that works like wonder! Thank you melba :)

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