Repository navigation
SysWin Gui ToolTip
Home › All Categories › sys/win › sys/win/gui › ToolTip
Creates tooltips for controls and windows and sets their text, timing, colours and place.
A tooltip control is a small pop-up window that shows a line of text when the mouse rests on a
tool: a control, or a rectangle in a window's client area. One tooltip control can serve any
number of tools. Every function here is written with the namespace:
ToolTip.SetMaxTipWidth( hTip, 300 ).
The quick way is AddTooltip: it creates a tooltip control for one control or
window, registers it as a tool and returns the tooltip's handle; SetTooltipText
changes the text later and DeleteTooltip removes the tool. Each call to
AddTooltip makes a new tooltip control, and that control has no owner: it is not destroyed
with your window, so destroy it with DestroyWindow when the window closes.
The other functions work on any tooltip control and are thin wrappers over its messages. A tool
is named by two members of a TOOLINFOW: hwnd, the window that holds it, and uId. For a
control registered with TTF_IDISHWND (as AddTooltip does), hwnd is the control's parent and
uId the control's handle; for a rectangle, hwnd is the window and uId a number of your own.
Functions that take a TOOLINFOW fill in its cbSize for you.
A few messages need version 6 of the common controls, which a program gets from a manifest or
from EnableVisualStyles(): without it, GetTitle reads nothing and
GetBubbleSize ended the test program. In the examples on this page, hCtrl is
a tooltip control.
#import "sys/win"
#import "sys/win/gui"
using win, guiTwo buttons with tooltips, one of them a balloon. Clicking Count rewrites its own tooltip; the tooltips are destroyed with the window.
#import "sys/win"
#import "sys/win/gui"
using win, gui
const IDC_COUNT = 101
dim shared as HWND hTipCount, hTipClose
dim shared as long nClicks
declare function WndProc( byval hwnd as HWND, byval uMsg as UINT, byval wParam as WPARAM, byval lParam as LPARAM ) as LRESULT
function main() as long
SetProcessDpiAwareness( PROCESS_SYSTEM_DPI_AWARE )
EnableVisualStyles()
dim pWindow as CWindow = "TipDemo"
dim hWin as HWND = pWindow.Create( NULL, "ToolTip", @WndProc )
pWindow.SetClientSize( 300, 120 )
pWindow.Center()
dim hCount as HWND = pWindow.AddControl( "Button", hWin, IDC_COUNT, "&Count", 40, 45, 100, 30 )
dim hClose as HWND = pWindow.AddControl( "Button", hWin, IDCANCEL, "&Close", 160, 45, 100, 30 )
hTipCount = ToolTip.AddTooltip( hCount, "Not clicked yet" )
hTipClose = ToolTip.AddTooltip( hClose, "Closes the window", true )
ToolTip.SetDelayTime( hTipCount, TTDT_INITIAL, 200 )
return pWindow.DoEvents( SW_NORMAL )
end function
function WndProc( byval hwnd as HWND, byval uMsg as UINT, byval wParam as WPARAM, byval lParam as LPARAM ) as LRESULT
select case uMsg
case WM_COMMAND
if CBCTLMSG( wParam, lParam ) = BN_CLICKED then
select case CBCTL( wParam, lParam )
case IDC_COUNT
nClicks += 1
dim text as ustring = "Clicked " & nClicks & " times"
ToolTip.SetTooltipText( hTipCount, GetDlgItem( hwnd, IDC_COUNT ), text )
case IDCANCEL
SendMessageW( hwnd, WM_CLOSE, 0, 0 )
end select
end if
return 0
case WM_DESTROY
DestroyWindow( hTipCount )
DestroyWindow( hTipClose )
PostQuitMessage( 0 )
return 0
end select
return DefWindowProcW( hwnd, uMsg, wParam, lParam )
end function
end main()| Function | Does |
|---|---|
| AddTooltip | Creates a tooltip control for a control or window. |
| SetTooltipText | Changes the text of a tooltip made by AddTooltip. |
| DeleteTooltip | Removes the tool that AddTooltip registered. |
| AddTool | Registers a tool from a TOOLINFOW. |
| DelTool | Removes a tool. |
| GetToolCount | Returns the number of tools. |
| EnumTools | Reads the tool at an index. |
| GetToolInfo | Reads what the control keeps about a tool. |
| SetToolInfo | Changes what the control keeps about a tool. |
| GetCurrentTool | Reads the tool the tip is being shown for. |
| GetText | Returns or reads a tool's text. |
| UpdateTipText | Changes a tool's text. |
| NewToolRect | Moves a rectangle tool. |
| HitTest | Finds the tool at a point. |
| Activate, Deactivate | Turns the tooltip control on or off. |
| Pop | Hides the tip being shown. |
| Popup | Shows the tip at the last mouse position. |
| Update | Redraws the tip being shown. |
| RelayEvent | Passes a mouse message on to the tooltip control. |
| GetDelayTime | Returns one of the delays, in milliseconds. |
| SetDelayTime | Sets one of the delays. |
| GetMaxTipWidth | Returns the width at which text wraps. |
| SetMaxTipWidth | Sets the width at which text wraps, allowing several lines. |
| GetMargin | Returns the margins around the text. |
| SetMargin | Sets the margins around the text. |
| GetBubbleSize | Returns the size the tip of a tool would have. |
| AdjustRect | Converts between a text rectangle and a tip window rectangle. |
| GetTipBkColor | Returns the background colour. |
| SetTipBkColor | Sets the background colour. |
| GetTipTextColor | Returns the text colour. |
| SetTipTextColor | Sets the text colour. |
| SetTitle | Adds a bold title and an icon to the tip. |
| GetTitle | Reads the title and icon. |
| SetWindowTheme | Sets the visual style the tip is drawn with. |
| SetDarkMode | Draws the tip in the dark style. |
| TrackActivate | Shows a tracking tip. |
| TrackDeactivate | Hides a tracking tip. |
| TrackPosition | Moves a tracking tip. |
function AddTooltip( byval hwnd as HWND, byref wszText as const wstring = "", byval bBalloon as boolean = false, byval bCentered as boolean = false ) as HWNDCreates a tooltip control (TTS_ALWAYSTIP, topmost, with no owner) and registers hwnd with it
as a tool, with TTF_SUBCLASS so that the tooltip watches the mouse by itself.
- For a child window (a control) the tool is the control:
hwndof the tool is its parent,uIdthe control, withTTF_IDISHWND. - For a top-level window the tool is its client rectangle as it is now, with
uId = 0. The rectangle does not follow later resizing; update it with NewToolRect.
The text is copied. Destroy the returned window when it is no longer needed.
| Parameter | Meaning |
|---|---|
hwnd |
The control or window the tip is for. |
wszText |
The text; with the default "" the tip stays hidden until text is set. |
bBalloon |
true for a balloon tip (TTS_BALLOON). |
bCentered |
true to centre the tip below the tool (TTF_CENTERTIP). |
Returns the tooltip control, or NULL when hwnd is not a window or the control could not
be created.
Example
dim hTip as HWND = ToolTip.AddTooltip( GetDlgItem( hwnd, IDOK ), "Saves the changes" )
dim hBalloon as HWND = ToolTip.AddTooltip( GetDlgItem( hwnd, IDCANCEL ), "Discards them", true )Microsoft Learn: TTM_ADDTOOL
sub SetTooltipText( byval hTooltip as HWND, byval hwnd as HWND, byref wszText as const wstring )Replaces the text of the tool registered for hwnd the way AddTooltip does it
(as a control for a child window, as a rectangle with uId = 0 for a top-level window). Does
nothing when there is no such tool or a handle is NULL.
Example
dim hBtn as HWND = GetDlgItem( hwnd, IDOK )
dim hTip as HWND = ToolTip.AddTooltip( hBtn, "Save" )
ToolTip.SetTooltipText( hTip, hBtn, "Save the changes and close" )Microsoft Learn: TTM_SETTOOLINFO
sub DeleteTooltip( byval hTooltip as HWND, byval hwnd as HWND )Removes the tool registered for hwnd by AddTooltip. The tooltip control itself
stays; destroy it with DestroyWindow.
Example
dim hBtn as HWND = GetDlgItem( hwnd, IDOK )
dim hTip as HWND = ToolTip.AddTooltip( hBtn, "Save" )
ToolTip.DeleteTooltip( hTip, hBtn )
DestroyWindow( hTip )Microsoft Learn: TTM_DELTOOL
function AddTool( byval hTooltip as HWND, byval lpti as TOOLINFOW ptr ) as booleanRegisters a tool described by a TOOLINFOW: uFlags (TTF_IDISHWND, TTF_SUBCLASS,
TTF_CENTERTIP, TTF_TRACK …), hwnd, uId, rect for a rectangle tool, and lpszText, which
the control copies (or LPSTR_TEXTCALLBACK to be asked with TTN_GETDISPINFOW). Without
TTF_SUBCLASS, pass the mouse messages to the control with RelayEvent.
Returns true on success; false on failure or for a NULL pointer.
Example
dim ti as TOOLINFOW
ti.uFlags = TTF_SUBCLASS
ti.hwnd = hwnd : ti.uId = 7
SetRect( @ti.rect, 100, 100, 200, 150 )
ti.lpszText = @wstr( "This area" )
ToolTip.AddTool( hCtrl, @ti )Microsoft Learn: TTM_ADDTOOL
sub DelTool overload( byval hTooltip as HWND, byval lpti as TOOLINFOW ptr )
sub DelTool overload( byval hTooltip as HWND, byref ti as TOOLINFOW )Removes the tool named by the hwnd and uId members.
Example
dim ti as TOOLINFOW
ti.hwnd = hwnd : ti.uId = 7
ToolTip.DelTool( hCtrl, ti )Microsoft Learn: TTM_DELTOOL
function GetToolCount( byval hTooltip as HWND ) as longReturns the number of tools the control has.
Returns the count; 1 for a control made by AddTooltip.
Example
print ToolTip.GetToolCount( hCtrl )Microsoft Learn: TTM_GETTOOLCOUNT
function EnumTools overload( byval hTooltip as HWND, byval iTool as DWORD, byval lpti as TOOLINFOW ptr ) as boolean
function EnumTools overload( byval hTooltip as HWND, byval iTool as DWORD, byref ti as TOOLINFOW ) as booleanReads the tool at zero-based index iTool into a TOOLINFOW. To get its text as well, point
lpszText at a buffer first.
Returns true when there is a tool at that index.
Example
dim ti as TOOLINFOW
for i as long = 0 to ToolTip.GetToolCount( hCtrl ) - 1
if ToolTip.EnumTools( hCtrl, i, ti ) then print ti.hwnd; ti.uId
nextMicrosoft Learn: TTM_ENUMTOOLS
function GetToolInfo overload( byval hTooltip as HWND, byval lpti as TOOLINFOW ptr ) as boolean
function GetToolInfo overload( byval hTooltip as HWND, byref ti as TOOLINFOW ) as boolean
function GetToolInfo overload( byval hTooltip as HWND ) as TOOLINFOWReads what the control keeps about the tool named by hwnd and uId (flags, rectangle,
instance and, with a buffer in lpszText, the text). The third form asks for the tool whose
hwnd and uId are both 0, so it finds nothing for tools made by AddTooltip
and returns a structure of zeros; use one of the first two.
Returns true when the tool exists; the third form returns the structure.
Example
dim ti as TOOLINFOW
ti.hwnd = hwnd : ti.uId = cast( UINT_PTR, GetDlgItem( hwnd, IDOK ) )
if ToolTip.GetToolInfo( hCtrl, ti ) then print hex( ti.uFlags )
dim tiZero as TOOLINFOW = ToolTip.GetToolInfo( hCtrl )Microsoft Learn: TTM_GETTOOLINFO
sub SetToolInfo overload( byval hTooltip as HWND, byval lpti as TOOLINFOW ptr )
sub SetToolInfo overload( byval hTooltip as HWND, byref ti as TOOLINFOW )Replaces everything the control keeps about the tool named by hwnd and uId with the
structure's members, text included. Read the tool with GetToolInfo first and
change what you need.
Example
dim ti as TOOLINFOW
ti.hwnd = hwnd : ti.uId = 7
if ToolTip.GetToolInfo( hCtrl, ti ) then
ti.lpszText = @wstr( "New text" )
ToolTip.SetToolInfo( hCtrl, ti )
end ifMicrosoft Learn: TTM_SETTOOLINFO
function GetCurrentTool overload( byval hTooltip as HWND, byval lpti as TOOLINFOW ptr ) as boolean
function GetCurrentTool overload( byval hTooltip as HWND, byref ti as TOOLINFOW ) as booleanReads the tool the control is showing its tip for, or the one under the mouse. With a NULL
pointer it only tells whether there is one.
Returns true when there is a current tool.
Example
if ToolTip.GetCurrentTool( hCtrl, NULL ) then ToolTip.Pop( hCtrl )Microsoft Learn: TTM_GETCURRENTTOOL
sub GetText overload( byval hTooltip as HWND, byval numChars as DWORD, byval lpti as TOOLINFOW ptr )
sub GetText overload( byval hTooltip as HWND, byval numChars as DWORD, byref ti as TOOLINFOW )
function GetText overload( byval hTooltip as HWND, byval hwnd as HWND, byval numChars as DWORD ) as ustringReads a tool's text. The first two forms copy at most numChars characters, terminator
included, into the buffer lpszText points to, for the tool named by hwnd and uId.
The third form finds the tool for a control or window as AddTooltip registers
it and returns its text in a ustring that is always numChars + 1 characters long: the text,
a null character, then spaces ("Click me" read with 80 comes back 81 characters long). Cut it
at the null character before using it. It returns "" when there is no such tool.
Returns the third form returns the text as described.
Example
dim s as ustring = ToolTip.GetText( hCtrl, GetDlgItem( hwnd, IDOK ), 80 )
s = left( s, instr( s, chr( 0 ) ) - 1 )
dim wszText as wstring * 80
dim ti as TOOLINFOW
ti.hwnd = hwnd : ti.uId = 7 : ti.lpszText = @wszText
ToolTip.GetText( hCtrl, 80, ti )Microsoft Learn: TTM_GETTEXT
sub UpdateTipText overload( byval hTooltip as HWND, byval lpti as TOOLINFOW ptr )
sub UpdateTipText overload( byval hTooltip as HWND, byref ti as TOOLINFOW )Changes only the text of the tool named by hwnd and uId, to lpszText.
Example
dim ti as TOOLINFOW
ti.hwnd = hwnd : ti.uId = 7 : ti.lpszText = @wstr( "Other area" )
ToolTip.UpdateTipText( hCtrl, ti )Microsoft Learn: TTM_UPDATETIPTEXT
sub NewToolRect overload( byval hTooltip as HWND, byval lpti as TOOLINFOW ptr )
sub NewToolRect overload( byval hTooltip as HWND, byref ti as TOOLINFOW )Gives the rectangle tool named by hwnd and uId the new rect, in the client coordinates of
hwnd. Call it from WM_SIZE for a tool that covers a window's client area.
Example
dim ti as TOOLINFOW
ti.hwnd = hwnd : ti.uId = 0
GetClientRect( hwnd, @ti.rect )
ToolTip.NewToolRect( hCtrl, ti )Microsoft Learn: TTM_NEWTOOLRECT
function HitTest overload( byval hTooltip as HWND, byval lphti as TTHITTESTINFOW ptr ) as boolean
function HitTest overload( byval hTooltip as HWND, byref phti as TTHITTESTINFOW ) as booleanFinds the rectangle tool of window hwnd that contains the point pt (client coordinates of
hwnd) and fills ti with it. Set ti.cbSize yourself.
Returns true when a tool is at the point.
Example
dim hti as TTHITTESTINFOW
hti.hwnd = hwnd : hti.pt.x = 150 : hti.pt.y = 120
hti.ti.cbSize = sizeof( TOOLINFOW )
if ToolTip.HitTest( hCtrl, hti ) then print "tool"; hti.ti.uIdMicrosoft Learn: TTM_HITTEST
sub Activate overload( byval hTooltip as HWND, byval fActivate as boolean )
sub Activate overload( byval hTooltip as HWND )
sub Deactivate( byval hTooltip as HWND )Turn the tooltip control on or off for all its tools. A deactivated control shows no tips until
it is activated again. Activate( hTip ) is Activate( hTip, true ).
Example
ToolTip.Deactivate( hCtrl )
ToolTip.Activate( hCtrl )
ToolTip.Activate( hCtrl, false )Microsoft Learn: TTM_ACTIVATE
sub Pop( byval hTooltip as HWND )Hides the tip that is being shown.
Example
ToolTip.Pop( hCtrl )Microsoft Learn: TTM_POP
sub Popup( byval hTooltip as HWND )Shows the tip at the coordinates of the last mouse message the control saw.
Example
ToolTip.Popup( hCtrl )Microsoft Learn: TTM_POPUP
sub Update( byval hTooltip as HWND )Redraws the tip that is being shown, after its text or look has changed.
Example
ToolTip.Update( hCtrl )Microsoft Learn: TTM_UPDATE
function RelayEvent overload( byval hTooltip as HWND, byval lpmsg as tagMSG ptr ) as long
function RelayEvent overload( byval hTooltip as HWND, byref msg as tagMSG ) as longPasses a mouse message to the control, for tools registered without TTF_SUBCLASS: the
control needs to see the mouse moving over them to know when to show a tip. Call it for each
WM_MOUSEMOVE and button message of the tool's window.
Returns 0.
Example
dim m as tagMSG
m.hwnd = hwnd : m.message = WM_MOUSEMOVE
ToolTip.RelayEvent( hCtrl, m )Microsoft Learn: TTM_RELAYEVENT
function GetDelayTime( byval hTooltip as HWND, byval flag as DWORD ) as longReturns one of the control's delays, in milliseconds: TTDT_INITIAL, how long the mouse must
rest before the tip appears (500 by default); TTDT_AUTOPOP, how long the tip stays (5000);
TTDT_RESHOW, the delay before the next tool's tip shows (100).
Returns the delay.
Example
print ToolTip.GetDelayTime( hCtrl, TTDT_INITIAL ) ' 500Microsoft Learn: TTM_GETDELAYTIME
sub SetDelayTime( byval hTooltip as HWND, byval flag as DWORD, byval iTime as short )Sets one of the delays of GetDelayTime, in milliseconds, up to 32767; -1
returns it to its default. TTDT_AUTOMATIC sets all three from one initial value.
Example
ToolTip.SetDelayTime( hCtrl, TTDT_INITIAL, 200 )
ToolTip.SetDelayTime( hCtrl, TTDT_AUTOPOP, 10000 )
ToolTip.SetDelayTime( hCtrl, TTDT_INITIAL, -1 ) ' 500 againMicrosoft Learn: TTM_SETDELAYTIME
function GetMaxTipWidth( byval hTooltip as HWND ) as longReturns the width, in pixels, beyond which the text wraps onto a new line.
Returns the width, or -1 when none is set (one line).
Example
print ToolTip.GetMaxTipWidth( hCtrl )Microsoft Learn: TTM_GETMAXTIPWIDTH
function SetMaxTipWidth( byval hTooltip as HWND, byval iWidth as long ) as longSets the width, in pixels, beyond which the text wraps; once one is set, the text may also hold
line breaks (chr( 13, 10 )). -1 goes back to a single line.
Returns the previous width.
Example
ToolTip.SetMaxTipWidth( hCtrl, 300 )Microsoft Learn: TTM_SETMAXTIPWIDTH
sub GetMargin overload( byval hTooltip as HWND, byval lprc as RECT ptr )
sub GetMargin overload( byval hTooltip as HWND, byref rc as RECT )
function GetMargin overload( byval hTooltip as HWND ) as ( long, long, long, long )Returns the space between the tip's border and its text, in pixels, with each RECT member
holding one side's margin.
Returns the third form returns ( left, top, right, bottom ).
Example
var (ml, mt, mr, mb) = ToolTip.GetMargin( hCtrl )
dim rc as RECT
ToolTip.GetMargin( hCtrl, rc )Microsoft Learn: TTM_GETMARGIN
sub SetMargin overload( byval hTooltip as HWND, byval lprc as RECT ptr )
sub SetMargin overload( byval hTooltip as HWND, byref rc as RECT )
sub SetMargin overload( byval hTooltip as HWND, byval nLeft as long, byval nTop as long, byval nRight as long, byval nBottom as long )Sets the space between the tip's border and its text, one side per RECT member.
Example
ToolTip.SetMargin( hCtrl, 4, 2, 4, 2 )Microsoft Learn: TTM_SETMARGIN
function GetBubbleSize overload( byval hTooltip as HWND, byval lpti as TOOLINFOW ptr ) as DWORD
function GetBubbleSize overload( byval hTooltip as HWND, byref ti as TOOLINFOW ) as DWORDReturns the size the tip of the tool named by hwnd and uId would have, width in the low word
and height in the high word. Needs version 6 of the common controls.
Returns the size, or 0 for a NULL pointer.
Example
dim ti as TOOLINFOW
ti.hwnd = hwnd : ti.uId = cast( UINT_PTR, GetDlgItem( hwnd, IDOK ) )
dim sz as DWORD = ToolTip.GetBubbleSize( hCtrl, ti )
print LOWORD( sz ); " x"; HIWORD( sz )Microsoft Learn: TTM_GETBUBBLESIZE
function AdjustRect overload( byval hTooltip as HWND, byval fLarger as boolean, byval lprc as RECT ptr ) as boolean
function AdjustRect overload( byval hTooltip as HWND, byval fLarger as boolean, byref rc as RECT ) as booleanWith fLarger = true, turns a text rectangle into the tip window rectangle that shows it; with
false, the other way. Use it when placing a tip over text in TTN_SHOW.
Returns true on success.
Example
dim rc as RECT
SetRect( @rc, 0, 0, 100, 20 )
ToolTip.AdjustRect( hCtrl, true, rc ) ' now the window rectangleMicrosoft Learn: TTM_ADJUSTRECT
function GetTipBkColor( byval hTooltip as HWND ) as COLORREFReturns the background colour of the tip.
Returns the colour.
Example
print hex( ToolTip.GetTipBkColor( hCtrl ) )Microsoft Learn: TTM_GETTIPBKCOLOR
sub SetTipBkColor( byval hTooltip as HWND, byval clr as COLORREF )Sets the background colour of the tip, a COLORREF such as an RGB_* constant. A tip drawn
with visual styles keeps its themed look; remove the theme with
SetWindowTheme( hTip, "", "" ) for the colour to show.
Example
ToolTip.SetTipBkColor( hCtrl, RGB_LIGHTYELLOW )Microsoft Learn: TTM_SETTIPBKCOLOR
function GetTipTextColor( byval hTooltip as HWND ) as COLORREFReturns the text colour of the tip.
Returns the colour.
Example
print hex( ToolTip.GetTipTextColor( hCtrl ) )Microsoft Learn: TTM_GETTIPTEXTCOLOR
sub SetTipTextColor( byval hTooltip as HWND, byval clr as COLORREF )Sets the text colour of the tip. Like SetTipBkColor it shows only on a tip not drawn with visual styles.
Example
ToolTip.SetTipTextColor( hCtrl, RGB_NAVY )Microsoft Learn: TTM_SETTIPTEXTCOLOR
function SetTitle( byval hTooltip as HWND, byval nIcon as long, byval pwszTitle as wstring ptr ) as booleanAdds a bold title above the text of every tip the control shows, with an icon: TTI_NONE,
TTI_INFO, TTI_WARNING, TTI_ERROR, their _LARGE forms, or an HICON.
Returns true on success.
Example
ToolTip.SetTitle( hCtrl, TTI_INFO, "Help" )Microsoft Learn: TTM_SETTITLE
sub GetTitle overload( byval hTooltip as HWND, byval pTTGetTitle as TTGETTITLE ptr )
sub GetTitle overload( byval hTooltip as HWND, byref tTTGetTitle as TTGETTITLE )Reads the title and icon set with SetTitle into a TTGETTITLE (dwSize is filled
in for you): set pszTitle to a buffer and cch to its size in characters. uTitleBitmap
receives the icon. Needs version 6 of the common controls.
Example
dim tt as TTGETTITLE
dim wszTitle as wstring * 100
tt.pszTitle = @wszTitle : tt.cch = 100
ToolTip.GetTitle( hCtrl, tt )Microsoft Learn: TTM_GETTITLE
sub SetWindowTheme( byval hTooltip as HWND, byval pwszTheme as wstring ptr )Sets the visual style the tip is drawn with, by the name of a theme class such as
"Explorer".
Example
ToolTip.SetWindowTheme( hCtrl, "Explorer" )Microsoft Learn: TTM_SETWINDOWTHEME
sub SetDarkMode( byval hTooltip as HWND )Draws the tip in Windows' dark style (the DarkMode_Explorer theme). The program needs visual
styles.
Example
dim hTip as HWND = ToolTip.AddTooltip( GetDlgItem( hwnd, IDOK ), "Save" )
ToolTip.SetDarkMode( hTip )sub TrackActivate overload( byval hTooltip as HWND, byval lpti as TOOLINFOW ptr )
sub TrackActivate overload( byval hTooltip as HWND, byref ti as TOOLINFOW )Shows the tip of a tracking tool, one registered with TTF_TRACK (and usually
TTF_ABSOLUTE), whose position the program sets with TrackPosition instead of
the mouse. The tool is named by hwnd and uId.
Example
dim ti as TOOLINFOW
ti.uFlags = TTF_TRACK or TTF_ABSOLUTE
ti.hwnd = hwnd : ti.uId = 9 : ti.lpszText = @wstr( "Here" )
ToolTip.AddTool( hCtrl, @ti )
ToolTip.TrackPosition( hCtrl, 200, 200 )
ToolTip.TrackActivate( hCtrl, ti )Microsoft Learn: TTM_TRACKACTIVATE
sub TrackDeactivate overload( byval hTooltip as HWND, byval lpti as TOOLINFOW ptr )
sub TrackDeactivate overload( byval hTooltip as HWND, byref ti as TOOLINFOW )Hides the tip of a tracking tool shown with TrackActivate.
Example
dim ti as TOOLINFOW
ti.hwnd = hwnd : ti.uId = 9
ToolTip.TrackDeactivate( hCtrl, ti )Microsoft Learn: TTM_TRACKACTIVATE
sub TrackPosition( byval hTooltip as HWND, byval xPos as long, byval yPos as long )Moves the tip of a tracking tool to (xPos, yPos), in screen coordinates.
Example
dim pt as POINT : GetCursorPos( @pt )
ToolTip.TrackPosition( hCtrl, pt.x + 16, pt.y + 16 )Microsoft Learn: TTM_TRACKPOSITION
tiko-lang · Home · Feature Index · Keyword Index · License
FreeBASIC manual pages reproduced under the GNU FDL 1.3.
- Generics
- Interfaces
- For Each
- Iterators
- Tuples
- Array Results
- Defer
- Lambdas
- Block Strings
- Partial Types
- String Slices
- Embed
- Typed Variadics
- C Header Import
- Foreign Library Linking
- UString
- Fixed-Width Types
- Nullptr
- String Library
- Format
- Array
- Map
- Set
- LinkedList
- OrderedMap
- OrderedSet
- Sorting
- Optional
- Result
- Smart Pointers
- Date and Time (Chrono)
- Filesystem
- File Streams
- Config (INI and TOML)
- Codec
- Hash
- UUID
- OS
- Process
- Net
- HTTP and TLS
- Math Library
- Finance
- Logging
- Terminal TUI Library
- PsControls
- tkControls
- sys/win
- Goroutines and Channels
- LLVM Backend
- tiko build
- TIKO_COMPILER
- Variable Declarations
- Standard Data Types
- User Defined Types
- Procedures
- Operators
- Control Flow Statements
- Converting Data Types
- Array Functions
- String Functions
- Mathematical Functions
- Bit Manipulation
- Date and Time Functions
- File I/O Functions
- Console Functions
- User Input (Runtime Library)
- User Input Functions (Graphics Library)
- Screen Functions
- 2D Drawing Functions
- Graphics Library Reference
- Graphics Keyword List
- Memory Functions
- Threading Support Functions
- Error Handling Functions
- Operating System Functions
- Preprocessor
- Intrinsic Defines
- Miscellaneous Keywords
- Modularizing