Tooltip – Giavapps Windows API

 

 

api_tooltip_create(Flags, ExFlags) This function creates a tooltip.

Flags: Flags of the control. Flags must be separated with the symbol "|".
ExFlags: extended flags of the control. Flags must be separated with the symbol "|".

 

Flags

 

This control supports the Window Styles and you can specify any of the styles listed below:

 

TTS_ALWAYSTIP Indicates that the tooltip control appears when the cursor is on a tool, even if the tooltip control’s owner window is inactive. Without this style, the tooltip appears only when the tool’s owner window is active.

TTS_BALLOON Indicates that the tooltip control has the appearance of a cartoon "balloon," with rounded corners and a stem pointing to the item.

TTS_CLOSE Displays a Close button on the tooltip. Valid only when the tooltip has the TTS_BALLOON style and a title ( see api_tooltip_set_title() ).

TTS_NOANIMATE Disables sliding tooltip animation on Windows 98 and Windows 2000 systems. This style is ignored on earlier systems.

TTS_NOFADE Disables fading tooltip animation on Windows 2000 systems. This style is ignored on earlier Windows NT systems, and on Windows 95 and Windows 98.

TTS_NOPREFIX Prevents the system from stripping ampersand characters from a string or terminating a string at a tab character. Without this style, the system automatically strips ampersand characters and terminates a string at the first tab character. This allows an application to use the same string as both a menu item and as text in a tooltip control.

 

Extended Flags

 

This control supports the Extended Window Styles.

 

Return Value

 

If the function succeeds, the return value is a handle to the new tooltip.

If the function fails, the return value is false.

To get extended error information, call api_control_get_last_error().

 

Control Functions

 

api_tooltip_create_ext(ToolHandle, Flags, ExFlags, Text) This function calls api_tooltip_create(), api_tooltip_set_tool() and api_tooltip_set_text() all in one and returns the TooltipHandle.

ToolHandle: this argument can be any control handle.
Flags: Flags of the control. Flags must be separated with the symbol "|".
ExFlags: extended flags of the control. Flags must be separated with the symbol "|".
Text: text of the tooltip.

 

api_tooltip_set_tool(TooltipHandle, ToolHandle) Registers a tool with a tooltip control. This function returns true if successful, or false otherwise.

TooltipHandle: it must be a TooltipHandle.
ToolHandle: this argument can be any control handle.

 

api_tooltip_delete_tool(TooltipHandle, ToolHandle) Removes a tool from a tooltip control.

TooltipHandle: it must be a TooltipHandle.
ToolHandle: this argument can be any control handle.

 

api_tooltip_set_text(TooltipHandle, ToolHandle, Text) Sets the text to the given tooltip.

TooltipHandle: it must be a TooltipHandle.
ToolHandle: this argument can be any control handle.
Text: text of the tooltip.

 

api_tooltip_get_text(ToolTipHandle, ToolHandle) This function returns the text of the given tooltip or an empty string otherwise. The returned string is limited to a max of 256 characters. This feature can be used only on Windows Vista and later.

TooltipHandle: it must be a TooltipHandle.
ToolHandle: this argument can be any control handle.

 

api_tooltip_set_delay_time(TooltipHandle, TimeFlag, DelayTime) Sets the initial, pop-up, and reshow durations for a tooltip control.

TooltipHandle: it must be a TooltipHandle.
TimeFlag: specifies which time value to set.
DelayTime: specifies the delay time, in milliseconds.

TimeFlag can be one of the following flags:

TTDT_AUTOPOP Set the amount of time a tooltip window remains visible if the pointer is stationary within a tool’s bounding rectangle. To return the autopop delay time to its default value, set DelayTime to -1.

TTDT_INITIAL Set the amount of time a pointer must remain stationary within a tool’s bounding rectangle before the tooltip window appears. To return the initial delay time to its default value, set DelayTime to -1.

TTDT_RESHOW Set the amount of time it takes for subsequent tooltip windows to appear as the pointer moves from one tool to another. To return the reshow delay time to its default value, set DelayTime to -1.

TTDT_AUTOMATIC Set all three delay times to default proportions. The autopop time will be ten times the initial time and the reshow time will be one fifth the initial time. If this flag is set, use a positive value of DelayTime to specify the initial time, in milliseconds. Set DelayTime to a negative value to return all three delay times to their default values.

 

api_tooltip_get_delay_time(TooltipHandle, TimeFlag) This function returns a real value with the specified duration in milliseconds.

TooltipHandle: it must be a TooltipHandle.
TimeFlag: specifies which duration value will be retrieved.

TimeFlag can be one of the following flags:

TTDT_AUTOPOP Retrieve the amount of time the tooltip window remains visible if the pointer is stationary within a tool’s bounding rectangle.

TTDT_INITIAL Retrieve the amount of time the pointer must remain stationary within a tool’s bounding rectangle before the tooltip window appears.

TTDT_RESHOW Retrieve the amount of time it takes for subsequent tooltip windows to appear as the pointer moves from one tool to another.

 

api_tooltip_set_title(TooltipHandle, IconHandle, Text) Adds a standard or custom icon and title string to a tooltip.

TooltipHandle: it must be a TooltipHandle.
IconHandle: this argument can be a flag which identifies a standard icon to associate with the tooltip. For Windows XP SP2 and later, this parameter can also contain an IconHandle.
Text: text of the title. This must not exceed 100 characters in length including the terminating NULL.

IconHandle can be one of the following flags:

TTI_NONE No icon.

TTI_INFO Info icon.

TTI_WARNING Warning icon.

TTI_ERROR Error Icon.

TTI_INFO_LARGE Large info Icon.

TTI_WARNING_LARGE Large warning Icon.

TTI_ERROR_LARGE Large error Icon

 

api_tooltip_hide(TooltipHandle) Removes a displayed tooltip window from view.

TooltipHandle: it must be a TooltipHandle.

 

Code Examples

 

Creating and Associating a Tooltip with a Control

 

tooltip = api_tooltip_create_ext(button,WS_POPUP | TTS_ALWAYSTIP | TTS_BALLOON,0,"This is a Tooltip!");

 

Setting a custom Delay Time

 

api_tooltip_set_delay_time(tooltip,TTDT_AUTOPOP,1000);//The Tooltip will disappear after 1 second…

 

Setting a Standard Icon and Custom Title

 

api_tooltip_set_title(tooltip,TTI_INFO_LARGE,"This is a Tooltip Title!");

 

I am Luigi Piscopo, also known as DJ GiDeejay / Producer / Remixer in the music world. I am a Producer with a lot of experience in photo editing, video editing, audio editing, graphic design, web design, programming and promotion.

Leave a Reply

Il tuo indirizzo email non sarà pubblicato. I campi obbligatori sono contrassegnati *

*