Jump to content

WinSetLboxItemText: Difference between revisions

From EDM2
Ak120 (talk | contribs)
mNo edit summary
 
Line 61: Line 61:


==Related Messages==
==Related Messages==
* LM_SETITEMTEXT
* [[LM_SETITEMTEXT]]


[[Category:Win]]
[[Category:Win]]

Latest revision as of 18:55, 14 May 2025

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