GLG Toolkit, JavaScript Library  Version 4.6
GlgTooltipFormatter Interface Reference

Tooltip formatter interface. More...

Detailed Description

Tooltip formatter interface.

A tooltip formatter is used to supply custom tooltip strings and is installed via SetTooltipFormatter.

Use CreateGlgTooltipFormatter to create a tooltip formatter.

Public Member Functions

String GetString (GlgObject viewport, GlgObject glg_object, GlgObject tooltip_obj, int root_x, int root_y)
 Tooltip formatting method. More...
 

Static Public Member Functions

static GlgTooltipFormatter CreateGlgTooltipFormatter (function tooltip_formatter_func)
 Constructor. More...
 

Member Function Documentation

◆ CreateGlgTooltipFormatter()

static GlgTooltipFormatter CreateGlgTooltipFormatter ( function  tooltip_formatter_func)
static

Constructor.

Creates a custom tooltip formatter that can be used as a parameter of the SetTooltipFormatter method.

The static method is invoked on the GLG Toolkit handle obtained via a 'new GlgToolkit()' call at the application start-up.

Parameters
tooltip_formatter_funcA custom tooltip formatter function to be invoked to provide a custom tooltip for an object when its tooltip is activated, The function's type signature must match the type signature of the GetString method.
Returns
An opaque internal object representing GlgTooltipFormatter.

◆ GetString()

String GetString ( GlgObject  viewport,
GlgObject  glg_object,
GlgObject  tooltip_obj,
int  root_x,
int  root_y 
)

Tooltip formatting method.

This method is invoked to get the text to be displayed in a tooltip. It can query an object's properties and display them in the tooltip. The returned string will be used as the tooltip text.

If the GlgTooltipFormatterOnErase global configuration resource is set to 1, the method will also be invoked with null parameters when the tooltip is erased.

Parameters
viewportThe viewport object for which tooltips are enabled via the ProcessMouse property.
glg_objectThe object that owns the TooltipString resource.
tooltip_objThe TooltipString object (S data object).
root_xThe x coordinate of the cursor relatively to the device screen.
root_yThe y coordinate of the cursor relatively to the device screen.
Returns
  • a string to be displayed in the tooltip
  • null to use the default tooltip
  • an empty string to skip displaying the tooltip.