WinInsertLboxItem
Appearance
This macro inserts text into a list box at index, index may be a LIT_ constant. The macro returns the actual index where it was inserted.
Syntax
WinInsertLboxItem(hwndLbox, index, psz)
Parameters
- hwndLbox (HWND) - Input
- List box handle.
- index (LONG) - Input
- Index of the list box item.
- psz (PSZ) - Input
- Text to be inserted.
Returns
- lRetIndex (LONG) - returns
- Actual index where it was inserted.
Remarks
This macro is defined as&colon.
#define WinInsertLboxItem(hwndLbox, index, psz) \ ((LONG)WinSendMsg(hwndLbox, \ LM_INSERTITEM, \ MPFROMLONG(index), \ MPFROMP(psz)))
This macro requires the existence of a message queue.
Example Code
#define INCL_WINWINDOWMGR /* Window Manager Functions */
#define INCL_WINLISTBOXES /* Window List Box definitions */
#include <os2.h>
LONG lIndex; /* inserted item index */
HWND hwndLbox; /* list box window handle */
MPARAM mpParam1; /* Parameter 1 (window handle) */
/* Array of list box item names */
PSZ pszItems[3] = {"Item1", "Item2", "Item3"};
case WM_INITDLG:
// ... other initialization ...
/*******************************/
/* Initialize List Box Control */
/*******************************/
/* get handle of list box */
hwndLbox = HWNDFROMMP(mpParam1);
/* insert 3 items into list box */
lIndex = WinInsertLboxItem(hwndLbox, LIT_END, pszItems[0]);
lIndex = WinInsertLboxItem(hwndLbox, LIT_END, pszItems[1]);
lIndex = WinInsertLboxItem(hwndLbox, LIT_END, pszItems[2]);
// ... other initialization ...