Re: Win32Lib bug...maybe...I think...

new topic     » goto parent     » topic index » view thread      » older message » newer message

-----Original Message-----
From: Jonas and Kristin Temple

>I have been really struggling with this one
>and thought it was in my code until I get the
>registered version of Euphoria and it showed
>me the error was in a routine in Win32Lib.  Here's
>the sequence of events to re-produce the bug:

The problem lies within deleteItem().  There were a couple of bugs dealing
with listviews.

You can change deleteItem as follows (this will be fixed in the next release
of win32lib):

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

    else

        LV_FINDINFO = struct_LVFINDINFO( LVFI_PARAM, "", pos, 0, 0, 0)

        iItem = sendMessage( id, LVM_FINDITEM, -1, LV_FINDINFO ) + 1

        release_mem(LV_FINDINFO)

        if not iItem then
            return 0
        end if

        msg = sendMessage( id, LVM_DELETEITEM, iItem-1, lParam )
        if msg then
            removeLVItem( pos )
        end if

        return msg

    end if
-- end changes to deleteItem()

Basically, when you tried to erase the items from one listview, win32lib
wiped out its records of ALL listviews. :(  Also, to delete one item
required you to know the item number (counted from the top of the listview)
rather than the win32lib item id.

>Again, I'm not certain if I'm doing something
>wrong but the bug ONLY happens when you call
>eraseItems for the list view control in the second
>window AND items are in the list view control in
>the main window.  How about that for obscure?  I'm
>working on a database order entry application and
>using list views are pretty central in my design.
>This is definitely keeping me from proceeding.

Nope, this was my mistake. :)  And I fully understand.  I've recently been
using a lot of listviews, and fixing a lot of my old bugs in win32lib, as
well as adding functionality that I didn't really know was needed when I
originally coded the listview wrappers.

>Since I'm on the subject, here's what I'd like to see
>added/changed in list view controls:

>- A removeColumns() routine to remove all the columns
>in a list view.  There are some circustances where it
>would be nice to rebuild the columns.

>- Ability to specify where to add the item using addLVItem
>routine.  The function currently uses 0 as the parameter
>of where to add the item.  If you are adding items from a
>database the first one you added is always the last one in
>the list.  It would be nice to have more control over that.
>I have changed this myself in Win32Lib but I want to stick
>with the official version.

I'll take a look at these two...

>- I don't have particulars about this one, but there seems
>to be a problem when retrieving a list view item and the user
>has clicked a column header to change the sort order of the
>items.  I don't think the internal sequence for the list view
>is being resorted.  Sorry I can't provide more detail.

Not sure about this one.  I haven't noticed anything wrong with this one,
unless it was resulting from the deleteItem problem.  Basically, all
win32lib does is the compare routine for windows, which does the actual
sorting itself.

Also, in the next version will be a routine to change text of a listview
item and a hittest, to allow things like selection using right clicks.

Matt Lewis

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu