Jump to content

WinSetLboxItemText

From EDM2
Revision as of 21:43, 26 November 2023 by Martini (talk | contribs) (Created page with "This macro sets the text of the list box indexed item to buffer. ==Syntax== WinSetLboxItemText(hwndLbox, index, psz) ==Parameters== ; hwndLbox (HWND) - input : List box ha...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This macro sets the text of the list box indexed item to buffer.

Syntax

WinSetLboxItemText(hwndLbox, index, psz)

Parameters

hwndLbox (HWND) - input
List box handle.
index (LONG) - input
Index of the list box item.
psz (PSZ) - input
Pointer to a null terminated string.

Returns

rc (BOOL) - returns
Success indicator.
TRUE
Successful completion
FALSE
Error occurred.

Remarks

This macro is defined as:

#define WinSetLboxItemText(hwndLbox, index, psz)  \
       ((BOOL)WinSendMsg(hwndLbox,               \
                         LM_SETITEMTEXT,         \
                         MPFROMLONG(index),      \
                         MPFROMP(psz)))

This macro requires the existence of a message queue.

Example Code

This example uses the WinSetLboxItemText call to set the months in a calendar list box.

#define INCL_WINDIALOGS
#include <OS2.H>

HWND    hwndLbox;
LONG    i;
typedef char MONTH[12];
MONTH months[12] = {"January", "February", "March",
                    "April", "May", "June", "July",
                    "August", "September", "October",
                    "November", "December" };

for (i=0; i<12; i++)
{
   WinSetLboxItemText(hwndLbox,
                      i,
                      months[i]);
} /* endfor */

Definition

#define INCL_WINWINDOWMGR /* Or use INCL_WIN, INCL_PM, */
#include <os2.h>

HWND    hwndLbox;  /*  List box handle. */
LONG    index;     /*  Index of the list box item. */
PSZ     psz;       /*  Pointer to a null terminated string. */
BOOL    rc;        /*  Success indicator. */

rc = WinSetLboxItemText(hwndLbox, index, psz);

Related Functions

Related Messages

  • LM_SETITEMTEXT