1. SetIndex - List View
- Posted by Tony Steward <figjam at nlc.net.au> Jun 15, 2001
- 371 views
Hi all, I have a need to setIndex in a listview but this is of cause not supported. Does anyone have any ideas. What I am trying to achieve is to have a listview with a textEditBox box below it, where I can type and the listview automatically scrolls to the nearest match. I have already achieved this with a normal List, so setting the index is what I need help with. Thanks Tony Steward
2. Re: SetIndex - List View
- Posted by Euman <euman at bellsouth.net> Jun 15, 2001
- 361 views
Tony this isnt tested, try it out and see if it works. If it doesnt then play around with it some.... VOID=sendMessage(id,LVM_SETITEMPOSITION,OLD_INDEX,LVM_SETITEMPOSITION) Euman euman at bellsouth.net ----- Original Message ----- From: "Tony Steward" <figjam at nlc.net.au> To: "EUforum" <EUforum at topica.com> Sent: Monday, January 01, 2001 18:41 Subject: SetIndex - List View > > > Hi all, > I have a need to setIndex in a listview but this is of cause not supported. > Does anyone have any ideas. > > What I am trying to achieve is to have a listview with a textEditBox box > below it, where I can type and the listview automatically scrolls to the > nearest match. I have already achieved this with a normal List, so setting > the index is what I need help with. > > Thanks > Tony Steward > > > >
3. Re: SetIndex - List View
- Posted by Euman <euman at bellsouth.net> Jun 15, 2001
- 380 views
This is the same info contained in deleteItem I looked at that too for a brief moment but couldnt figure out how to send the new Item to the top position in the LV. hence my one liner which I wasnt sure would do what he wanted. Good Job Matt I hope someday soon to understand all the conversions from the MS-SDK to Win32lib "I WILL EVENTUALLY" Euman euman at bellsouth.net ----- Original Message ----- From: "Matthew Lewis" > > -- this function should be in .56, although the name will be different > global function getLViItemFromlParam( integer id, integer lv_id ) > atom findlv, item > > findlv = struct_LVFINDINFO( LVFI_PARAM, "", lv_id, 0, 0, 0 ) > item = sendMessage( id, LVM_FINDITEM, -1, findlv ) > release_mem( findlv ) > > return item > end function > > -- Can set multiple selections, and first item will be made visible > procedure setLVIndex( integer id, object sel ) > integer iItem > atom lvitem > if atom(sel) then > sel = {sel} > end if > lvitem = struct_LVITEM( LVIF_STATE, 0, 0, LVIS_SELECTED, LVIS_SELECTED, > 0,0,0) > for i = length( sel ) to 1 by -1 do > iItem = getLViItemFromlParam( id, sel[i] ) > store( lvitem, LVITEM_iItem, iItem ) > VOID = sendMessage( id, LVM_SETITEMSTATE, iItem, lvitem ) > end for > VOID = sendMessage( id, LVM_ENSUREVISIBLE, iItem, 0 ) > end procedure > > > Matt Lewis >
4. Re: SetIndex - List View
- Posted by Tony Steward <figjam at nlc.net.au> Jun 15, 2001
- 378 views
Hi all, Matt thanks once again to your support for this list. One small problem is in the last line of the code: VOID = sendMessage( id, LVM_ENSUREVISIBLE, iItem, 0 ) i Get Error LVM_ENSUREVISIBLE has not been declared. I looked through the code and found TVM_ENSUREVISIBLE but not LVM. I assume I could just add something like LVM_ENSUREVISIBLE = (LVM_FIRST+0), But i notice each line has a different value to add to LVM_FIRST Thanks Tony Come Visit Me At www.locksdownunder.com ----- Original Message ----- From: "Matthew Lewis" <matthewwalkerlewis at YAHOO.COM> To: "EUforum" <EUforum at topica.com> Sent: Saturday, June 16, 2001 6:50 AM Subject: RE: SetIndex - List View > > > > > From: "Tony Steward" <figjam at nlc.net.au> > > > Hi all, > > > I have a need to setIndex in a listview but this is of > > cause not supported. > > > Does anyone have any ideas. > > > > > > What I am trying to achieve is to have a listview with a > > textEditBox box > > > below it, where I can type and the listview automatically > > scrolls to the > > > nearest match. I have already achieved this with a normal > > List, so setting > > > the index is what I need help with. > > > From: Euman [mailto:euman at bellsouth.net] > > > Tony this isnt tested, try it out and see if it works. If it > > doesnt then > > play around with it some.... > > > > VOID=sendMessage(id,LVM_SETITEMPOSITION,OLD_INDEX,LVM_SETITEMPOSITION) > > This would actually change the position of the item relative to the other > items in the list. There's no one-liner (that I'm aware of) that will do > this for you. Part of the issue is that you have to do a conversion between > win32lib id for each item (stored as the lParam member of the listview item) > and the iItem (which identifies the item by order in the list). The > following should give the same functionality as setIndex does for lists > (Derek, this would make a good 'Dispatch' for setItem in the listview file): > > -- this function should be in .56, although the name will be different > global function getLViItemFromlParam( integer id, integer lv_id ) > atom findlv, item > > findlv = struct_LVFINDINFO( LVFI_PARAM, "", lv_id, 0, 0, 0 ) > item = sendMessage( id, LVM_FINDITEM, -1, findlv ) > release_mem( findlv ) > > return item > end function > > -- Can set multiple selections, and first item will be made visible > procedure setLVIndex( integer id, object sel ) > integer iItem > atom lvitem > if atom(sel) then > sel = {sel} > end if > lvitem = struct_LVITEM( LVIF_STATE, 0, 0, LVIS_SELECTED, LVIS_SELECTED, > 0,0,0) > for i = length( sel ) to 1 by -1 do > iItem = getLViItemFromlParam( id, sel[i] ) > store( lvitem, LVITEM_iItem, iItem ) > VOID = sendMessage( id, LVM_SETITEMSTATE, iItem, lvitem ) > end for > VOID = sendMessage( id, LVM_ENSUREVISIBLE, iItem, 0 ) > end procedure > > > Matt Lewis > > > > >