Groups | Search | Server Info | Login | Register


Groups > comp.os.os2.programmer.misc > #1659

Re: LN_SELECT in list box with multiple selection

Newsgroups comp.os.os2.programmer.misc
Date 2019-04-04 16:38 -0700
References <52a63651$0$6668$9b4e6d93@newsspool2.arcor-online.net>
Message-ID <84e6b286-99f3-41eb-acd6-399a25e744c9@googlegroups.com> (permalink)
Subject Re: LN_SELECT in list box with multiple selection
From nwoodr@gmail.com

Show all headers | View raw


On Monday, December 9, 2013 at 4:29:50 PM UTC-5, Marcel Müller wrote:
> I have a listbox with style LS_MULTISEL|LS_EXTENDEDSEL and get a 
> WM_CONTROL message with LN_SELECT. How do I examine what item recently 
> has been selected or deselected? The documentation says one should use 
> LM_QUERYSELECTION, but this does not reflect the recent changes.
> 
> 
> Marcel

I know that this is a very old question but I wanted to give a straight answer since one was not posted and someone might come looking for an answer...

You need to start by defining a select index, it needs to be signed...

SHORT sSelectIndex;

To find the first item selected you need to set sSelectIndex to return the first item selected...

sSelectIndex = LIT_FIRST;

Then you loop through the lmquery until sSelectIndex is equal LIT_NONE...

while ((sSelectIndex = (USHORT)(ULONG)WinSendMsg(hWndLstBox,
                            LM_QUERYSELECTION, MPFROMSHORT((SHORT)sSelectIndex), 0L)) != LIT_NONE)
{
    CHAR szText[256];
    // query list box item for text
    WinSendMsg(hWndLstBox,
       LM_QUERYITEMTEXT, MPFROM2SHORT(sSelectIndex, sizeof(szText)),
                        MPFROMP(szText));
    printf(szText);

}

I hope someone finds this answer.

Back to comp.os.os2.programmer.misc | Previous | NextPrevious in thread | Find similar


Thread

LN_SELECT in list box with multiple selection Marcel Müller <news.5.maazl@spamgourmet.org> - 2013-12-09 22:29 +0100
  Re: LN_SELECT in list box with multiple selection Paul Ratcliffe <abuse@orac12.clara34.co56.uk78> - 2013-12-10 00:15 +0000
  Re: LN_SELECT in list box with multiple selection nwoodr@gmail.com - 2019-04-04 16:38 -0700

csiph-web