Jump to content

WinSetLboxItemText: Difference between revisions

From EDM2
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..."
 
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
This macro sets the text of the list box indexed item to buffer.  
This macro sets the text of the list box indexed item to buffer.


==Syntax==
==Syntax==
Line 5: Line 5:


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


;index (LONG) - input
==Returns==
:Index of the list box item.  
;rc (BOOL) - returns:Success indicator.
:;TRUE:Successful completion
:;FALSE:Error occurred.


;psz (PSZ) - input
:Pointer to a null terminated string.
==Returns==
;rc (BOOL) - returns
:Success indicator.
:;TRUE
::Successful completion
:;FALSE
::Error occurred.
==Remarks==
==Remarks==
This macro is defined as:
This macro is defined as:
Line 27: Line 21:
                           MPFROMLONG(index),      \
                           MPFROMLONG(index),      \
                           MPFROMP(psz)))
                           MPFROMP(psz)))
This macro requires the existence of a message queue.


This macro requires the existence of a message queue.
==Example Code==
==Example Code==
This example uses the WinSetLboxItemText call to set the months in a calendar list box.
This example uses the WinSetLboxItemText call to set the months in a calendar list box.
<pre>
<pre>
#define INCL_WINDIALOGS
#define INCL_WINDIALOGS
#include <OS2.H>
#include <os2.h>


HWND    hwndLbox;
HWND    hwndLbox;
Line 44: Line 37:
                     "November", "December" };
                     "November", "December" };


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


Line 68: Line 59:
==Related Functions==
==Related Functions==
* [[WinSendMsg]]
* [[WinSendMsg]]
==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