# wxSimpleHtmlListBox Class Reference
[Controls]

`#include <wx/htmllbox.h>`

Inheritance diagram for wxSimpleHtmlListBox:
[legend]

## Detailed Description

wxSimpleHtmlListBox is an implementation of wxHtmlListBox which shows HTML content in the listbox rows.

Unlike wxHtmlListBox, this is not an abstract class and thus it has the advantage that you can use it without deriving your own class from it. However, it also has the disadvantage that this is not a virtual control and thus it's not well-suited for those cases where you need to show a huge number of items: every time you add/insert a string, it will be stored internally and thus will take memory.

The interface exposed by wxSimpleHtmlListBox fully implements the wxControlWithItems interface, thus you should refer to wxControlWithItems's documentation for the API reference for adding/removing/retrieving items in the listbox. Also note that the wxVListBox::SetItemCount function is `protected` in wxSimpleHtmlListBox's context so that you cannot call it directly, wxSimpleHtmlListBox will do it for you.

Note: in case you need to append a lot of items to the control at once, make sure to use the Append(const wxArrayString&) function.

Thus the only difference between a wxListBox and a wxSimpleHtmlListBox is that the latter stores strings which can contain HTML fragments (see the list of tags supported by wxHTML).

Note that the HTML strings you fetch to wxSimpleHtmlListBox should not contain the `<html>` or `<body>` tags.

## Styles

This class supports the following styles:

- wxHLB_DEFAULT_STYLE:
  The default style: wxBORDER_SUNKEN
- wxHLB_MULTIPLE:
  Multiple-selection list: the user can toggle multiple items on and off.

A wxSimpleHtmlListBox emits the same events used by wxListBox and by wxHtmlListBox.

## Events emitted by this class

Event macros for events emitted by this class:

- EVT_LISTBOX(id, func):
  Process a `wxEVT_COMMAND_LISTBOX_SELECTED` event, when an item on the list is selected. See wxCommandEvent.
- EVT_LISTBOX_DCLICK(id, func):
  Process a `wxEVT_COMMAND_LISTBOX_DOUBLECLICKED` event, when the listbox is double-clicked. See wxCommandEvent.
- EVT_HTML_CELL_CLICKED(id, func):
  A wxHtmlCell was clicked. See wxHtmlCellEvent.
- EVT_HTML_CELL_HOVER(id, func):
  The mouse passed over a wxHtmlCell. See wxHtmlCellEvent.
- EVT_HTML_LINK_CLICKED(id, func):
  A wxHtmlCell which contains an hyperlink was clicked. See wxHtmlLinkEvent

##

Library: wxHTML

Category: Controls
Appearance:

wxMSW appearance | wxGTK appearance | wxMac appearance

See also:
  wxSimpleHtmlListBox::Create

## Public Member Functions
| wxSimpleHtmlListBox (wxWindow *parent, wxWindowID id, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, int n=0, const wxString choices[]=NULL, long style=wxHLB_DEFAULT_STYLE, const wxValidator &validator=wxDefaultValidator, const wxString &name=wxSimpleHtmlListBoxNameStr)
| Constructor, creating and showing the HTML list box.
| wxSimpleHtmlListBox (wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, const wxArrayString &choices, long style=wxHLB_DEFAULT_STYLE, const wxValidator &validator=wxDefaultValidator, const wxString &name=wxSimpleHtmlListBoxNameStr)
| Constructor, creating and showing the HTML list box.
| wxSimpleHtmlListBox ()
| Default constructor, you must call Create() later.
virtual | ~wxSimpleHtmlListBox ()
| Frees the array of stored items and relative client data.
bool | Create (wxWindow *parent, wxWindowID id, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, int n=0, const wxString choices[]=NULL, long style=wxHLB_DEFAULT_STYLE, const wxValidator &validator=wxDefaultValidator, const wxString &name=wxSimpleHtmlListBoxNameStr)
| Creates the HTML listbox for two-step construction.
bool | Create (wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, const wxArrayString &choices, long style=wxHLB_DEFAULT_STYLE, const wxValidator &validator=wxDefaultValidator, const wxString &name=wxSimpleHtmlListBoxNameStr)
| Creates the HTML listbox for two-step construction.

List of all members.

## Constructor & Destructor Documentation

wxSimpleHtmlListBox::wxSimpleHtmlListBox | ( | wxWindow * | parent,
|  | wxWindowID | id,
|  | const wxPoint & | pos = `wxDefaultPosition`,
|  | const wxSize & | size = `wxDefaultSize`,
|  | int | n = `0`,
|  | const wxString | choices[] = `NULL`,
|  | long | style = `wxHLB_DEFAULT_STYLE`,
|  | const wxValidator & | validator = `wxDefaultValidator`,
|  | const wxString & | name = `wxSimpleHtmlListBoxNameStr` |
| ) |  |  |

Constructor, creating and showing the HTML list box.

Parameters:

  | parent | Parent window. Must not be NULL.
  | id | Window identifier. A value of -1 indicates a default value.
  | pos | Window position. If wxDefaultPosition is specified then a default position is chosen.
  | size | Window size. If wxDefaultSize is specified then the window is sized appropriately.
  | n | Number of strings with which to initialise the control.
  | choices | An array of strings with which to initialise the control.
  | style | Window style. See wxHLB_* flags.
  | validator | Window validator.
  | name | Window name.

wxSimpleHtmlListBox::wxSimpleHtmlListBox | ( | wxWindow * | parent,
|  | wxWindowID | id,
|  | const wxPoint & | pos,
|  | const wxSize & | size,
|  | const wxArrayString & | choices,
|  | long | style = `wxHLB_DEFAULT_STYLE`,
|  | const wxValidator & | validator = `wxDefaultValidator`,
|  | const wxString & | name = `wxSimpleHtmlListBoxNameStr` |
| ) |  |  |

Constructor, creating and showing the HTML list box.

Parameters:

  | parent | Parent window. Must not be NULL.
  | id | Window identifier. A value of -1 indicates a default value.
  | pos | Window position.
  | size | Window size. If wxDefaultSize is specified then the window is sized appropriately.
  | choices | An array of strings with which to initialise the control.
  | style | Window style. See wxHLB_* flags.
  | validator | Window validator.
  | name | Window name.

wxSimpleHtmlListBox::wxSimpleHtmlListBox | ( |  | ) |

Default constructor, you must call Create() later.

virtual wxSimpleHtmlListBox::~wxSimpleHtmlListBox | ( |  | ) | `[virtual]`

Frees the array of stored items and relative client data.

## Member Function Documentation

bool wxSimpleHtmlListBox::Create | ( | wxWindow * | parent,
|  | wxWindowID | id,
|  | const wxPoint & | pos,
|  | const wxSize & | size,
|  | const wxArrayString & | choices,
|  | long | style = `wxHLB_DEFAULT_STYLE`,
|  | const wxValidator & | validator = `wxDefaultValidator`,
|  | const wxString & | name = `wxSimpleHtmlListBoxNameStr` |
| ) |  |  |

Creates the HTML listbox for two-step construction.

See wxSimpleHtmlListBox() for further details.

bool wxSimpleHtmlListBox::Create | ( | wxWindow * | parent,
|  | wxWindowID | id,
|  | const wxPoint & | pos = `wxDefaultPosition`,
|  | const wxSize & | size = `wxDefaultSize`,
|  | int | n = `0`,
|  | const wxString | choices[] = `NULL`,
|  | long | style = `wxHLB_DEFAULT_STYLE`,
|  | const wxValidator & | validator = `wxDefaultValidator`,
|  | const wxString & | name = `wxSimpleHtmlListBoxNameStr` |
| ) |  |  |

Creates the HTML listbox for two-step construction.

See wxSimpleHtmlListBox() for further details.

|  | [ top ]