Re: Win32Lib bug?

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

Larry Miller wrote:
> 
> I am having a problem with Win32Lib v .60.6, although it might possibly be my
> code.
> In any case this is the situation:
> 
> My application opens a modal dialog box with a listview control. The first 
> time it opens and closes with no errors or warnings. But if the dialog is 
> opened a second time I receive the following warning from Win32Lib:
> Error code 497
> getHandle: Object is destroyed
> 
> The Listview requires no images and none have been added with addIcon but 
> it does use the LVS_EX_CHECKBOXES extended style.
> The problem only occurs when the dialog window is destroyed, not if it is
> simply closed.

[snip]

> Is this normal behaviour for Win32Lib or am I doing something wrong?

Neither. This is a mistake (two actually) that I've made in the library. 

The mistakes are that when the first ListView (or TreeView) is created, I
also create a couple of imagelists, but instead of having them owned by
the main window (which is what was intended by my code), I had them owned
by the window that owned the ListView. In your case the dialog window.

The other mistake I made was when the imagelists were destroyed, I failed to
reset the built-in imagelist ids back to zero. If I had have done that
I would have recreated them again when you recreated the dialog window.

The imagelists were being destroyed because you destroyed the dialog window
which was their parent window.

The workaround is simple. Just force the imagelists to be created such that
they are owned by the main window. Do something like this ...

constant mainwin = create(Window, "Main", 0, 0, 0, 500, 400, 0)
-- Workaround for imagelist bug --
constant dummylv = create(ListView, "", mainwin, 0, 0, 0, 0, 0)
destroy(dummylv)


In the meantime, I'll fix these mistakes I've made in the library.

-- 
Derek Parnell
Melbourne, Australia

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

Search



Quick Links

User menu

Not signed in.

Misc Menu