Timppa Posted October 19, 2015 Share Posted October 19, 2015 (edited) Hello! Again a problem encountered 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 EndFuncThis 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 EndFuncINSTEAD of this:Func Example() If $Debug = 1 Then ToolTip("We are in Function Example()") Sleep(1000) EndIf Send("Hello Example!") Sleep(2000) Exit EndFuncSo 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 SleepSorry for very long explanation for simple thing, but I don't want any misunderstandings.Thanks in advance! Edited October 19, 2015 by Timppa Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 19, 2015 Moderators Share Posted October 19, 2015 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 ;==>ToolTipCustomM23 Timppa 1 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Timppa Posted October 20, 2015 Author Share Posted October 20, 2015 Okay that works like wonder! Thank you melba Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now