Contents Up Previous Next

wxSimpleHtmlListBox

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.

Derived from

wxHtmlListBox, wxControlWithItems
wxVListBox
wxVScrolledWindow
wxPanel
wxWindow
wxEvtHandler
wxObject

Include files

<wx/htmllbox.h>

Window styles

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

See also window styles overview.

Event handling

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

The event handlers for the following events take a wxCommandEvent:

EVT_LISTBOX(id, func) Process a wxEVT_COMMAND_LISTBOX_SELECTED event, when an item on the list is selected.
EVT_LISTBOX_DCLICK(id, func) Process a wxEVT_COMMAND_LISTBOX_DOUBLECLICKED event, when the listbox is double-clicked.

The event handlers for the following events take a wxHtmlCellEvent or a wxHtmlLinkEvent:

EVT_HTML_CELL_CLICKED(id, func) A wxHtmlCell was clicked.
EVT_HTML_CELL_HOVER(id, func) The mouse passed over a wxHtmlCell.
EVT_HTML_LINK_CLICKED(id, func) A wxHtmlCell which contains an hyperlink was clicked.

Members

wxSimpleHtmlListBox::wxSimpleHtmlListBox
wxSimpleHtmlListBox::~wxSimpleHtmlListBox
wxSimpleHtmlListBox::Create


wxSimpleHtmlListBox::wxSimpleHtmlListBox

wxHtmlListBox(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 = "simpleHtmlListBox")

wxHtmlListBox(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 = "simpleHtmlListBox")

Constructor, creating and showing the HTML list box.

Parameters

parent

id

pos

size

n

choices

style

validator

name

See also

wxSimpleHtmlListBox::Create

wxSimpleHtmlListBox()

Default constructor, you must call Create() later.


wxSimpleHtmlListBox::~wxSimpleHtmlListBox

~wxSimpleHtmlListBox()

Frees the array of stored items and relative client data.


wxSimpleHtmlListBox::Create

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

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 = "simpleHtmlListBox")

Creates the HTML listbox for two-step construction. See wxSimpleHtmlListBox::wxSimpleHtmlListBox for further details.