TListBox:Select() bug

TListBox:Select() bug

Postby Enrico Maria Giordano » Thu Feb 16, 2006 12:52 pm

When the listbox is multiselection Select() method doesn't work. This is the sample. The first item is not selected at start:

Code: Select all  Expand view  RUN
#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oDlg

    LOCAL oLbx

    LOCAL cVar := ""

    DEFINE DIALOG oDlg

    @ 1, 1 LISTBOX oLbx VAR cVar ITEMS { "Bert", "Carl", "William" }

    oLbx:nStyle += LBS_MULTIPLESEL

    @ 3, 1 BUTTON "&Close" ACTION oDlg:End()

    ACTIVATE DIALOG oDlg;
             ON INIT oLbx:Select( 1 );
             CENTER

    RETURN NIL


A possible fix is to change the Select() method:

Code: Select all  Expand view  RUN
METHOD Select( nItem ) INLINE If( ! ::IsMultipleSel(), ::SendMsg(
LB_SETCURSEL, nItem - 1, 0 ), ::SetSel( nItem ) ),;
                                 ::Change()


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 49 guests