Jump to content

Custom ToolTip


Timppa
 Share

Recommended Posts

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

  • Moderators

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

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...