wb_set_text

bool wb_set_text (int wbobject, mixed text [, int item [, int subitem]])

Sets the text and/or the tooltip of a WinBinder object. wb_set_text can also rename or create items in certain controls. The actual action depends on the object class.

To create a tooltip (small hint window), text must be an array with two elements. The first one is the new caption (or NULL if changing is not required) and the second one is the new tooltip (or NULL if changing is not required). Most classes support tooltips. See the table below to check which classes do support them.

For multi-segment status bars, parameter item in wb_set_text() will set the text of the specified segment (0 is default). For single-segment status bars, item is ignored.

Returns TRUE on success or FALSE if an error occurs.

Control class information

See the following table.

Class

Type

Action

Tooltips

Calendar

Array

Set tooltip.

Yes

CheckBox

String or array

Sets the text of the control.

Yes

ComboBox

Array

Creates items, one per array element.

Yes

EditBox

String or array

Sets the text of the control.

Yes

Frame

String

Sets the text of the control.

No

Gauge

Array

Set tooltip.

Yes

Hyperlink

Array

Set tooltip.

Yes

ImageButton

Array

Set tooltip.

Yes

InvisibleArea

Array

Set tooltip.

Yes

Label

String

Sets the text of the control.

No

ListBox

Array

Creates items, one per array element.

Yes

ListView

Array

Creates column titles, one per array element, or changes cell contents.

No

Menu

String

Sets the text of the menu item specified by the item identifier.

No

PushButton

String or array

Sets the text of the control.

Yes

RadioButton

String or array

Sets the text of the control.

Yes

RTFEditBox

String or array

Sets the text of the control.

Yes

ScrollBar

Array

Set tooltip.

Yes

Slider

Array

Set tooltip.

Yes

Spinner

Array

Set tooltip.

Yes

StatusBar

String or array

Sets the text of the status bar or its segments.

Yes

TabControl

Array

Creates or renames tab pages.

Yes

TreeView

Array

Creates or renames treeview nodes.

Yes

Window class information

For all classes of windows and dialog boxes, wb_set_text() sets the window title and/or the window tooltip. All classes support tooltips.

Example

wb_set_text($PushButton1, "OK")                                 // Changes the text of a button
wb_set_text($PushButton1, array("OK", null))                    // This does the same
wb_set_text($PushButton1, array(null, "Accept changes"'));      // Changes only the tooltip
wb_set_text($PushButton2, array("Cancel", "Ignore changes"));   // This sets both at once

wb_set_text($ComboBox, "Item 1\nItem 2\nItem 3")                // Creates items on a combo box
wb_set_text($TabControl, "Tab 1\nTab 2\nTab 3")                 // Creates tabs on a tab control

See also

wb_get_text
Control functions
Window functions