# wxCommandLinkButton Class Reference
[Controls]

`#include <wx/commandlinkbutton.h>`

Inheritance diagram for wxCommandLinkButton:
[legend]

## Detailed Description

Objects of this class are similar in appearance to the normal wxButtons but to the links in a web page in functionality.

Pressing such button usually results in switching to another window of the program and so they can be used as a replacement for the "Next" button in a multi-page dialog (such as wxWizard), for example.

Their advantage compared to the ordinary wxButtons is that they emphasize the action of switching the window and also that they allow to give more detailed explanation to the user because, in addition to the short button label, they also show a longer description string.

The short, title-like, part of the label is called the main label and the longer description is the note. Both of them can be set and queried independently using wxCommandLinkButton-specific methods such as SetMainLabel() or GetNote() or also via SetLabel() and GetLabel() methods inherited from wxButton. When using the latter, the main label and the note are concatenated into a single string using a new line character between them (notice that the note part can have more new lines in it).

wxCommandLinkButton generates the same event as wxButton but doesn't support any of wxButton-specific styles nor adds any new styles of its own.

Currently this class uses native implementation under Windows Vista and later versions and a generic implementation for the other platforms and earlier Windows versions.

Since:
  2.9.2

##

Library: wxAdvanced

Category: Controls
Appearance:

wxMSW appearance | wxGTK appearance | wxMac appearance

See also:
  wxButton, wxBitmapButton

## Public Member Functions
| wxCommandLinkButton ()
| Default constructor.
| wxCommandLinkButton (wxWindow *parent, wxWindowID id, const wxString &mainLabel=wxEmptyString, const wxString &note=wxEmptyString, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0, const wxValidator &validator=wxDefaultValidator, const wxString &name=wxButtonNameStr)
| Constructor really creating a command Link button.
bool | Create (wxWindow *parent, wxWindowID id, const wxString &mainLabel=wxEmptyString, const wxString &note=wxEmptyString, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0, const wxValidator &validator=wxDefaultValidator, const wxString &name=wxButtonNameStr)
| Button creation function for two-step creation.
void | SetMainLabelAndNote (const wxString &mainLabel, const wxString &note)
| Sets a new main label and note for the button.
virtual void | SetLabel (const wxString &label)
| Sets the string label and note for the button.
wxString | GetLabel () const
| Returns the string label for the button.
void | SetMainLabel (const wxString &mainLabel)
| Changes the main label.
void | SetNote (const wxString &note)
| Changes the note.
wxString | GetMainLabel () const
| Returns the current main label.
wxString | GetNote () const
| Returns the currently used note.

List of all members.

## Constructor & Destructor Documentation

wxCommandLinkButton::wxCommandLinkButton | ( |  | ) |

Default constructor.

Use Create() to really create the control.

wxCommandLinkButton::wxCommandLinkButton | ( | wxWindow * | parent,
|  | wxWindowID | id,
|  | const wxString & | mainLabel = `wxEmptyString`,
|  | const wxString & | note = `wxEmptyString`,
|  | const wxPoint & | pos = `wxDefaultPosition`,
|  | const wxSize & | size = `wxDefaultSize`,
|  | long | style = `0`,
|  | const wxValidator & | validator = `wxDefaultValidator`,
|  | const wxString & | name = `wxButtonNameStr` |
| ) |  |  |

Constructor really creating a command Link button.

The button will be decorated with stock icons under GTK+ 2.

Parameters:

  | parent | Parent window. Must not be NULL.
  | id | Button identifier. A value of wxID_ANY indicates a default value.
  | mainLabel | First line of text on the button, typically the label of an action that will be made when the button is pressed.
  | note | Second line of text describing the action performed when the button is pressed.
  | pos | Button position.
  | size | Button size. If the default size is specified then the button is sized appropriately for the text.
  | style | Window style. See wxButton class description.
  | validator | Window validator.
  | name | Window name.

See also:
  Create(), wxValidator

## Member Function Documentation

bool wxCommandLinkButton::Create | ( | wxWindow * | parent,
|  | wxWindowID | id,
|  | const wxString & | mainLabel = `wxEmptyString`,
|  | const wxString & | note = `wxEmptyString`,
|  | const wxPoint & | pos = `wxDefaultPosition`,
|  | const wxSize & | size = `wxDefaultSize`,
|  | long | style = `0`,
|  | const wxValidator & | validator = `wxDefaultValidator`,
|  | const wxString & | name = `wxButtonNameStr` |
| ) |  |  |

Button creation function for two-step creation.

For more details, see wxCommandLinkButton().

wxString wxCommandLinkButton::GetLabel | ( |  | ) | const`[virtual]`

Returns the string label for the button.

See also:
  SetLabel()

Returns:
  A string with the main label and note concatenated together with a newline separating them.

Reimplemented from wxButton.

wxString wxCommandLinkButton::GetMainLabel | ( |  | ) | const

Returns the current main label.

Returns:
  Main label currently displayed.

wxString wxCommandLinkButton::GetNote | ( |  | ) | const

Returns the currently used note.

Returns:
  Note currently displayed.

virtual void wxCommandLinkButton::SetLabel | ( | const wxString & | label | ) | `[virtual]`

Sets the string label and note for the button.

Parameters:

  | label | The label and note to set, with the two separated by the first newline or none to set a blank note.

Reimplemented from wxButton.

void wxCommandLinkButton::SetMainLabel | ( | const wxString & | mainLabel | ) |

Changes the main label.

Parameters:

  | mainLabel | New main label to use.

void wxCommandLinkButton::SetMainLabelAndNote | ( | const wxString & | mainLabel,
|  | const wxString & | note |
| ) |  |  |

Sets a new main label and note for the button.

Neither of the arguments can be empty, if you need to change just the label or just the note, use SetMainLabel() or SetNote() instead of this function.

Parameters:

  | mainLabel | New main label to use.
  | note | New note to use.

void wxCommandLinkButton::SetNote | ( | const wxString & | note | ) |

Changes the note.

Parameters:

  | note | New note to use.

|  | [ top ]