Re: Matt re:setListviewIndex
- Posted by Tony Steward <figjam at nlc.net.au> Jul 30, 2001
- 434 views
Ha all, No Derek as there are time when I want to select multiple items but not when I'm searching the LV Thanks anyway Tony Steward > >Couldn't one just create a ListView with LVS_SINGLESEL style? Would that >work? > > MyLV = create(ListView,..., LVS_SINGLESEL) > >---- >Derek. > >----- Original Message ----- >From: "Matthew Lewis" <matthewwalkerlewis at YAHOO.COM> >To: "EUforum" <EUforum at topica.com> >Sent: Tuesday, July 31, 2001 6:24 AM >Subject: Re: Matt re:setListviewIndex > > > > > > ----- Original Message ----- > > From: "Tony Steward" <figjam at nlc.net.au> > > > > > Hi Matt or anyone who can help, > > > Matt sent me the routine below so I could set the index of a listview, > > > which works well thanks thankyou. At the moment when you set one index >that > > > index is made visible and highlighted. If you then set a second index >both > > > are highlighted. I would prefer that when an index is set that the >previous > > > selection be cleared. Is this possible. > > > > You're correct. That code only changes the status of the item you've > > specified, but doesn't 'unselect' the currently selected item(s). I'm not > > certain when I sent that to you, but in my copy of .55, I've modified >setIndex > > (did it on 1/26/01): > > > > I added integers: > > integer msg, > > -- added for listview: > > start, check, ix, count > > > > and added an elsif clause that cycles through the listview and > > deselects/selects as appropriate. It might be faster for larger listviews >to > > merely get the selected group of items and deselect those, then selecting >your > > list. > > > > elsif window_type[id] = ListView then > > > > if atom( index ) then > > index = { index } > > end if > > > > start = 0 > > > > result = struct_LVITEM( LVIF_STATE, start, 0, 0, > > LVIS_SELECTED, 0, 0, 0 ) > > > > store( result, LVITEM_stateMask, LVIS_SELECTED ) > > count = sendMessage( id, LVM_GETITEMCOUNT, 0, 0) > > while count do > > > > ix = getLVItemlParam( id, start ) > > if find( ix, index ) then > > store( result, LVITEM_state, LVIS_SELECTED ) > > else > > store( result, LVITEM_state, 0 ) > > end if > > > > VOID = sendMessage( id, LVM_SETITEMSTATE, start, result ) > > start += 1 > > count -= 1 > > end while > > > > -- release the structure from memory > > ix = new_memset() > > manage_mem( ix, result ) > > release_mem( ix ) > > return > > > > > > ===== > > Matt Lewis > > http://www14.brinkster.com/matthewlewis > > > > > > Regards Tony Steward Come Visit Me At www.locksdownunder.com Give your hardest tasks to the laziest workers, as they will find the easiest way to complete it.