wxRuby Documentation Home

Wx::HyperlinkCtrl

This class shows a static text element which links to an URL.
Appearance and behaviour is completely customizable. In fact, when the user
clicks on the hyperlink, a HyperlinkEvent is
sent but if that event is not handled (or it’s skipped; see
Event#skip), then a call to
LaunchDefaultBrowser is done with the
hyperlink’s URL.

Note that standard Window functions like set_background_colour, set_font, set_cursor, set_label can be used to customize appearance of the hyperlink.

Derived from

Control

Window

EvtHandler

Object

Window styles

HL_ALIGN_LEFT Align the text to the left.
HL_ALIGN_RIGHT Align the text to the right.
HL_ALIGN_CENTRE Center the text (horizontally).
HL_CONTEXTMENU Pop up a context menu when the hyperlink is right-clicked. The context menu contains a ``Copy URL" menu item which is automatically handled by the hyperlink and which just copies in the clipboard the URL (not the label) of the control.
HL_DEFAULT_STYLE The default style for HyperlinkCtrl: @NO_BORDER HL_CONTEXTMENU HL_ALIGN_CENTRE@.

See also window styles overview.

Event handling

To process input from an hyperlink control, use these event handler macros to
direct input to member functions that take a
HyperlinkEvent argument.

evt_hyperlink(id) { | event | … } The hyperlink was (left) clicked. If this event is not handled in user’s code (or it’s skipped; see Event#skip), then a call to LaunchDefaultBrowser is done with the hyperlink’s URL.

See also

URL, HyperlinkEvent

Methods

HyperlinkCtrl#hyper_link

_hyper_link(%(arg-type)Window% parent, Integer id, String label, String url, Point pos = DEFAULT_POSITION, Size size = DEFAULT_SIZE, Integer style, String name = “hyperlink”)

Constructor. See Create for more info.

HyperlinkCtrl#create

Boolean create(%(arg-type)Window% parent, Integer id, String label, String url, Point pos = DEFAULT_POSITION, Size size = DEFAULT_SIZE, Integer style, String name = “hyperlink”)

Creates the hyperlink control.

Parameters

HyperlinkCtrl#get_hover_colour

Colour get_hover_colour()

Returns the colour used to print the label of the hyperlink when the mouse is over the control.

HyperlinkCtrl#set_hover_colour

set_hover_colour(%(arg-type)Colour% colour)

Sets the colour used to print the label of the hyperlink when the mouse is over the control.

HyperlinkCtrl#get_normal_colour

Colour get_normal_colour()

Returns the colour used to print the label when the link has never been clicked before
(i.e. the link has not been visited) and the mouse is not over the control.

HyperlinkCtrl#set_normal_colour

set_normal_colour(%(arg-type)Colour% colour)

Sets the colour used to print the label when the link has never been clicked before
(i.e. the link has not been visited) and the mouse is not over the control.

HyperlinkCtrl#get_visited_colour

Colour get_visited_colour()

Returns the colour used to print the label when the mouse is not over the control
and the link has already been clicked before (i.e. the link has been visited).

HyperlinkCtrl#set_visited_colour

set_visited_colour(%(arg-type)Colour% colour)

Sets the colour used to print the label when the mouse is not over the control
and the link has already been clicked before (i.e. the link has been visited).

HyperlinkCtrl#get_visited

Boolean get_visited()

Returns if the hyperlink has already been clicked by the user at least one time.

HyperlinkCtrl#set_visited

set_visited(%(arg-type)Boolean% visited = true)

Marks the hyperlink as visited (see set_visited_colour).

HyperlinkCtrl#get_url

String get_url()

Returns the URL associated with the hyperlink.

HyperlinkCtrl#set_url

set_url(%(arg-type)String% url)

Sets the URL associated with the hyperlink.

[This page automatically generated from the Textile source at 2023-06-13 21:31:43 +0000]