Core Function ToolTip

From Sputnik Wiki
(Difference between revisions)
Jump to: navigation, search
(Created page with "<pre> ToolTip( <text>, <x>, <y> ) </pre> === Description === Creates a tooltip anywhere on the screen. ==== text ==== The text of the tooltip. (An empty string will delete a ...")
 
m (1 revision)
 
(6 intermediate revisions by one user not shown)
Line 9: Line 9:
 
==== text ====
 
==== text ====
  
The text of the tooltip. (An empty string will delete a displaying tooltip).
+
The text of the tooltip.
  
 
==== x, y ====
 
==== x, y ====
Line 17: Line 17:
 
=== Return Value ===
 
=== Return Value ===
  
Returns the value of the previous setting.
+
Returns the HWND of the new tooltip so it can be destroyed later using ToolTipKill().
  
 
=== Remarks ===
 
=== Remarks ===
Line 25: Line 25:
 
If the coords would cause the tooltip to run off screen, it is repositioned to visible.
 
If the coords would cause the tooltip to run off screen, it is repositioned to visible.
  
Tooltip appears until it is cleared, until script terminates, or sometimes until it is clicked upon. You may use @CR or @LF to create multi-line tooltips.
+
Tooltip appears until it is cleared, until program terminates, or ***sometimes*** until it is clicked upon. You may use @CR or @LF to create multi-line tooltips.
 +
 
 +
Note you can create as many tooltips as you wish however its best to store their Handles so you can delete them later using ToolTipKill.
  
 
=== Example ===
 
=== Example ===
Line 31: Line 33:
 
<syntaxhighlight lang="sputnik">
 
<syntaxhighlight lang="sputnik">
 
// This will create a tooltip in the upper left of the screen
 
// This will create a tooltip in the upper left of the screen
ToolTip("This is a tooltip", 0, 0); // Create a tooltip
+
$a = ToolTip("This is a tooltip", 0, 0); // Create a tooltip
 
Sleep(2000); // Sleep to give tooltip time to display
 
Sleep(2000); // Sleep to give tooltip time to display
ToolTip(""); // Remove the tooltip
+
ToolTipKill($a); // Remove the tooltip
  
  
 
// Same as above but this time place the tooltip at the mouse pointer
 
// Same as above but this time place the tooltip at the mouse pointer
ToolTip("This is a tooltip"); // Create a tooltip
+
$a = ToolTip("This is a tooltip"); // Create a tooltip
 
Sleep(2000); // Sleep to give tooltip time to display
 
Sleep(2000); // Sleep to give tooltip time to display
ToolTip(""); // Remove the tooltip
+
ToolTip($a); // Remove the tooltip
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 +
Heres an example of a program with 2 hotkeys the first hotkey A will create a tooltip and the second hotkey B will delete all tooltips
 +
 +
<syntaxhighlight lang="sputnik">
 +
Global $lol = array();
 +
Global $i = 0;
 +
 +
$GUI = GUICreate("Window", "mooooo", 200, 200);
 +
GUILoad( $GUI );
 +
 +
HotKeySet("a", "lol();");
 +
HotKeySet("b", "lol2();");
 +
 +
While ( GUIStatus( $GUI ) ) DoEvents( );
 +
 +
Function lol()
 +
{
 +
push($lol, ToolTip("This is a tooltip $i"));
 +
$i++;
 +
}
 +
 +
Function lol2()
 +
{
 +
foreach($lol as $l)
 +
{
 +
ToolTipKill($l);
 +
}
 +
$lol = array();
 +
}
 +
</syntaxhighlight>
 
[[Category:Core Function]]
 
[[Category:Core Function]]

Latest revision as of 12:38, 14 June 2015

ToolTip( <text>, <x>, <y> )

Contents

Description

Creates a tooltip anywhere on the screen.

text

The text of the tooltip.

x, y

Optional; The x,y position of the tooltip.

Return Value

Returns the HWND of the new tooltip so it can be destroyed later using ToolTipKill().

Remarks

If the x and y coordinates are omitted the, tip is placed near the mouse cursor.

If the coords would cause the tooltip to run off screen, it is repositioned to visible.

Tooltip appears until it is cleared, until program terminates, or ***sometimes*** until it is clicked upon. You may use @CR or @LF to create multi-line tooltips.

Note you can create as many tooltips as you wish however its best to store their Handles so you can delete them later using ToolTipKill.

Example

// This will create a tooltip in the upper left of the screen
$a = ToolTip("This is a tooltip", 0, 0); // Create a tooltip
Sleep(2000); // Sleep to give tooltip time to display
ToolTipKill($a); // Remove the tooltip
 
 
// Same as above but this time place the tooltip at the mouse pointer
$a = ToolTip("This is a tooltip"); // Create a tooltip
Sleep(2000); // Sleep to give tooltip time to display
ToolTip($a); // Remove the tooltip

Heres an example of a program with 2 hotkeys the first hotkey A will create a tooltip and the second hotkey B will delete all tooltips

Global $lol = array();
Global $i = 0;
 
$GUI = GUICreate("Window", "mooooo", 200, 200);
GUILoad( $GUI );
 
HotKeySet("a", "lol();");
HotKeySet("b", "lol2();");
 
While ( GUIStatus( $GUI ) ) DoEvents( );
 
Function lol()
{
	push($lol, ToolTip("This is a tooltip $i"));
	$i++;
}
 
Function lol2()
{
	foreach($lol as $l)
	{
		ToolTipKill($l);
	}
	$lol = array();
}
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox