TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Graeme Geldenhuys
from: Stephane Bessette
date: 1996-07-14 07:11:24
subject: Dropdown List Box info needed...

-=> Quoting Graeme Geldenhuys to All <=-

 GG> WinSendDlgItemMsg (hWnd, IDC_SOURCE, LM_INSERTITEM,
 GG> (MPARAM)LIT_END, szSource[i]);

 GG> This worked fine as far as I know...  If I now click on the downarrow
 GG> next to the list box, it displays the three options to me.  If I done
 GG> it the correct way, I got no idea...  :-) 

        WinSendDlgItemMsg(hWnd, IDC_SOURCE, LM_INSERTITEM,
             MPFROMP(LIT_END), szSource[i]);

 GG> Well, my problem now is, I don't know how to find out what option the
 GG> user has selected from the list.  How do I get that info from the
 GG> program...?

        index=LIT_FIRST;
        char array[100];
        do {
           index=WinSendDlgItemMsg(hWnd, IDC_SOURCE, LM_QUERYSELECTION,
              MPFROMP(index), 0);
           if(index != LIT_NONE) { // found something selected
                WinSendDlgItemMsg(hWnd, IDC_SOURCE, LM_QUERYITEMTEXT,
                    MPFROM2SHORT(index, sizeof(array)),
                    MPFROMP(array));// get the text selected
           }
        } while(index != LIT_NON);


    LM_QUERYSELECTION returns the first item that is selected after
the index.  What you'll have to try is whether the first item is
returned when it is selected.  It should be, but it's better to check.

 GG> Also when I open the dialog box, it doesn't display an initial value
 GG> in the list box, you must always click on the downarrow first to see
 GG> the options, before it displays anything.  How can I overcome that, so
 GG> that it displays the first option in the array as default when I open
 GG> the dialog. 

        You have to update the dialog.  Use:

        WinSendMsg(hWnd, WM_UPDATEFRAME, 0, 0);


        Stephane [TEAM OS/2]
... Backup not found: (A)bort (R)etry (S)lap nearest innocent bystander.
--- Blue Wave/OS2 v2.20
* Origin: Juxtaposition BBS (1:167/133)
SEEN-BY: 50/99 270/101 620/243 625/100 711/401 409 410 413 430 808 809 934
SEEN-BY: 711/955 712/407 515 517 624 628 713/888 800/1
@PATH: 167/133 116 90 270/101 712/515 711/808 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.