1. Re: weird listview behavior
- Posted by Euman <euman at bellsouth.net> Jun 11, 2001
- 342 views
I wonder what DeleteItem has to do with runing the example and it crashing out of the blue. well, not just out of the blue but on a re-Paint of the window. Run the example and make a selection of a combo that loads some data into the listviews select a different city from the bottom listview now, open up an underlying program and bring the program back it should CRASH right there. The amount of items that are visible is the length(sequence) compared e.g: 8 items available for visiblabitlty but trying to display 10. Euman ----- Original Message ----- From: "Matthew Lewis" <matthewwalkerlewis at YAHOO.COM> To: "EUforum" <EUforum at topica.com> Sent: Monday, June 11, 2001 10:45 Subject: RE: weird listview behavior > > > > > -----Original Message----- > > From: jstory at freenet.edmonton.ab.ca > > > I have two listviews. > > They work ok for a few seconds or a minute. > > Then I get a crash. The error message says: > > > > "in function fDoLVN_GETDISPINFO() > > subscript value 10 is out of bounds, reading from a sequence of 8" > > > > If I do stuff with only one listview (either one), no crash. > > If I do stuff with both, they work for a while, and then > > apparently for no > > reason I get the crash. Maybe the way I move the mouse or > > somesuch silly > > thing. > > > > What's happening? > > This is a bug in deleteItem(). Basically, it was deleting ALL listview > items, not just those belonging to the listview in question. You can change > the elsif clause in deleteItem() to what I have below here, and it will work > like it should: > > elsif window_type[ id ] = ListView then > if pos = -1 then > msg = LVM_DELETEALLITEMS > iItem = 1 > while iItem <= length( lvitem_owner ) do > if lvitem_owner[iItem] = id then > removeLVItem( iItem ) > if iItem < length(lvitem_owner) then > iItem += 1 > end if > else > iItem += 1 > end if > end while > > > And BTW, listview seems to not have the onClick event. I thought > > listview is like listbox except it has columns. Listbox has > > the onClick > > event; why not also listview? > > Listviews handle mouse events a little differently (apparently). You need > to add: > > hWnd = fetch( lParam, NMHDR_hwndFrom ) > id = getId( hWnd ) > invokeHandler( id, w32HClick, {} ) > return {} > end function > > ...and make sure you also modify: > > constant kNotifications = > { > TCN_SELCHANGE > , LVN_COLUMNCLICK <snip> > > >