Class: Wx::RichToolTip

Inherits:
Object
  • Object
show all
Defined in:
lib/wx/doc/gen/rich_tool_tip.rb

Overview

Note:

This class is untracked and should not be derived from nor instances extended!

Allows showing a tool tip with more customizations than ToolTip.

Using this class is very simple, to give a standard warning for a password text control if the password was entered correctly you could simply do:

password = Wx::TextCtrl.new(..., style: Wx::TE_PASSWORD)
  # ...
  tip = Wx::RichToolTip.new("Caps Lock is on",
                            "You might have made an error in your password\n" +
                            "entry because Caps Lock is turned on.\n" +
                            "\n" +
                            "Press Caps Lock key to turn it off.")
   tip.set_icon(Wx::ICON_WARNING)
   tip.show_for(password)

Currently this class has generic implementation that can be used with any window and implements all the functionality but doesn’t exactly match the appearance of the native tooltips (even though it makes some efforts to use the style most appropriate for the current platform) and a native MSW version which can be only used with text controls and doesn’t provide as much in the way of customization. Because of this, it’s inadvisable to customize the tooltips unnecessarily as doing this turns off auto-detection of the native style in the generic version and may prevent the native MSW version from being used at all. Notice that this class is not derived from Window and hence doesn’t represent a window, even if its #show_for method does create one internally to show the tooltip.

Category: Miscellaneous Windows

Requires:

  • USE_RICHTOOLTIP

Instance Method Summary collapse

Constructor Details

#initialize(title, message) ⇒ Wx::RichToolTip

Constructor must specify the tooltip title and main message.

The main message can contain embedded new lines. Both the title and message must be non-empty. Additional attributes can be set later.

Parameters:

  • title (String)
  • message (String)


99
# File 'lib/wx/doc/gen/rich_tool_tip.rb', line 99

def initialize(title, message) end

Instance Method Details

#set_background_colour(col, colEnd = (Wx::Colour.new())) ⇒ void Also known as: background_colour=

This method returns an undefined value.

Set the background colour.

If two colours are specified, the background is drawn using a gradient from top to bottom, otherwise a single solid colour is used. By default the colour or colours most appropriate for the current platform are used. If a colour is explicitly set, native MSW version won’t be used as it doesn’t support setting the colour.

Parameters:

  • col (Wx::Colour, String, Symbol)
  • colEnd (Wx::Colour, String, Symbol) (defaults to: (Wx::Colour.new()))


108
# File 'lib/wx/doc/gen/rich_tool_tip.rb', line 108

def set_background_colour(col, colEnd=(Wx::Colour.new())) end

#set_icon(icon = Wx::ICON_INFORMATION) ⇒ void #set_icon(icon) ⇒ void Also known as: icon=

Overloads:

  • #set_icon(icon = Wx::ICON_INFORMATION) ⇒ void

    This method returns an undefined value.

    Set the small icon to show.

    The icon can be either one of the standard information/warning/error ones, i.e. ICON_INFORMATION, ICON_WARNING or ICON_ERROR respectively (the question icon doesn’t make sense for a tooltip so ICON_QUESTION can’t be used here) or a custom icon. The latter is unsupported by the native MSW implementation of this class so the use of a standard icon is preferred.

    Parameters:

    • icon (Integer) (defaults to: Wx::ICON_INFORMATION)
  • #set_icon(icon) ⇒ void

    This method returns an undefined value.

    Set the small icon to show.

    The icon can be either one of the standard information/warning/error ones, i.e. ICON_INFORMATION, ICON_WARNING or ICON_ERROR respectively (the question icon doesn’t make sense for a tooltip so ICON_QUESTION can’t be used here) or a custom icon. The latter is unsupported by the native MSW implementation of this class so the use of a standard icon is preferred.



89
# File 'lib/wx/doc/gen/rich_tool_tip.rb', line 89

def set_icon(*args) end

#set_timeout(millisecondsTimeout, millisecondsDelay = 0) ⇒ void Also known as: timeout=

This method returns an undefined value.

Set timeout after which the tooltip should disappear and optionally set a delay before the tooltip is shown, in milliseconds.

By default the tooltip is shown immediately and hidden after a system-dependent interval of time elapses. This method can be used to change this or also disable hiding the tooltip automatically entirely by passing 0 in this parameter (but doing this will prevent the native MSW version from being used). Notice that the tooltip will always be hidden if the user presses a key or clicks a mouse button. Parameter millisecondsDelay is new since wxWidgets 2.9.5.

Parameters:

  • millisecondsTimeout (unsigned)
  • millisecondsDelay (unsigned) (defaults to: 0)


119
# File 'lib/wx/doc/gen/rich_tool_tip.rb', line 119

def set_timeout(millisecondsTimeout, millisecondsDelay=0) end

#set_tip_kind(tipKind) ⇒ void Also known as: tip_kind=

This method returns an undefined value.

Choose the tip kind, possibly none.

See TipKind documentation for the possible choices here. By default the tip is positioned automatically, as if TipKind::TipKind_Auto was used. Native MSW implementation doesn’t support setting the tip kind explicitly and won’t be used if this method is called with any value other than TipKind::TipKind_Auto. Notice that using non automatic tooltip kind may result in the tooltip being positioned partially off screen and it’s the callers responsibility to ensure that this doesn’t happen in this case.

Parameters:



129
# File 'lib/wx/doc/gen/rich_tool_tip.rb', line 129

def set_tip_kind(tipKind) end

#set_title_font(font) ⇒ void Also known as: title_font=

This method returns an undefined value.

Set the title text font.

By default it’s emphasized using the font style or colour appropriate for the current platform. Calling this method prevents the native MSW implementation from being used as it doesn’t support changing the font.

Parameters:



137
# File 'lib/wx/doc/gen/rich_tool_tip.rb', line 137

def set_title_font(font) end

#show_for(win, rect = nil) ⇒ void

This method returns an undefined value.

Show the tooltip for the given window and optionally specify where to show the tooltip.

By default the tooltip tip points to the (middle of the) specified window which must be non-null or, if rect is non-nil, the middle of the specified Wx::Rect. The coordinates of the rect parameter are relative to the given window. Currently the native MSW implementation is used only if win is a TextCtrl and rect is nil. This limitation may be removed in the future. Parameter rect is new since wxWidgets 2.9.5.

Parameters:



149
# File 'lib/wx/doc/gen/rich_tool_tip.rb', line 149

def show_for(win, rect=nil) end