getCtlItemText

Syntax

int getCtlItemText(int n, int item, char* str)

Arguments

n
The number of the control
item
The number of the item to retrieve
str
Pointer to a string where the result will be stored

Return

Returns false if the control number is out of range or not in use, or if LB_ERR was returned by the internal Win32 SendMessage calls. Returns true otherwise.

Description

Gets the text of a COMBOBOX, LISTBOX or TAB control item.

Comment

This function only works with LISTBOX, COMBOBOX and TAB controls. It will currently return true if used with other control types, even though the function didn't succeed.

Example

%fml

ctl[0]: COMBOBOX(VSCROLL),
        Text="Harry\nLarry\nBarry\n"
        "Gary\nCarrie\nSally", Val=0,
        Size=(*,50)
ctl[6]: STATICTEXT, Text=""

OnCtl(n): {

  // Display the selected text value
  if (n == 0) {
    getCtlItemText(0, ctl(0), str0);
    setCtlText(6, str0);
  }

  return true;
}

See Also

deleteCtlItem, deleteCtlItems, (setCtlItemText)?