1. Windows treeview bug!
- Posted by tone.skoda at siol.net
Oct 23, 2001
This is a multi-part message in MIME format.
------=_NextPart_000_0016_01C15C3A.E0D99920
charset="iso-8859-2"
If Treeview is created with TVS_NOSCROLL style and all its items are deleted
with
sendMessage (TV, TVM_DELETEITEM, 0, TVI_ROOT)
before items are inserted,
then tree items are not visible until next time tree is resized.
This is Windows bug, because I tried it with C++ program and it was the
same.
It was also very hard to discover.
What to do :-o ???
Additional quesion:
When's next release of Win32Lib and which version are we suposed to use now?
I use alpha .56.
------=_NextPart_000_0016_01C15C3A.E0D99920
Content-Type: application/octet-stream;
name="Treeview Bug.exw"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename="Treeview Bug.exw"
--// If Treeview is created with TVS_NOSCROLL style and all its items =
are deleted
--// with
--// sendMessage (TV, TVM_DELETEITEM, 0, TVI_ROOT)
--// before items are inserted,
--// then tree items are not visible until next time tree is resized.
--//=20
--// This is Windows bug, because I tried it with C++ program and it was =
the
--// same.
-- Demo for Listview wrappers.
-- Matt Lewis (matthewlewis at hotmail.com)
without warning
--// include win32lib_full.ew
include win32lib.ew -- Version: 0.56 28/Jan/2001
atom LV, TV
object VOID
with trace
constant=20
Win =3D create( Window, "ListView Demo", 0, Default, Default, 640, 460, =
0 )
TV =3D create( TreeView,
"Treeview",
Win,
10,
10,
300, --CW_USEDEFAULT,
300, --CW_USEDEFAULT,
or_all({TVS_HASLINES, TVS_LINESATROOT, TVS_HASBUTTONS,
TVS_SHOWSELALWAYS, TVS_NOSCROLL})) --// Create =
treevierw with TVS_NOSCROLL style. Tone Skoda.
LV =3D create( ListView,
{ "Library", "Author" },
Win,
320,
10,
300, --CW_USEDEFAULT,
300, --CW_USEDEFAULT,
or_all({LVS_REPORT, LVS_SHOWSELALWAYS}))
atom iExw, ptr, mask, current
current =3D 0
ptr =3D allocate_string( "exw" )
mask =3D or_all( {LVIF_IMAGE, LVIF_PARAM, LVIF_TEXT})
iExw =3D w32Func(xLoadIcon,{instance(), ptr} )
free(ptr)
constant=20
closefolder =3D addIcon( extractIcon( "clsdfold.ico" ) ),
openfolder =3D addIcon( extractIcon( "openfold.ico" )),
win =3D addIcon( iExw ),
dos =3D addIcon( extractIcon( "disk05.ico" )),
linux =3D addIcon( extractIcon( "disk06.ico" )),
generic =3D addIcon( extractIcon( "disks04.ico" ))
sequence folders, location, lParams, lv
folders =3D {}
location =3D {}
lParams =3D {}
--// Delete all items. Tone Skoda.
VOID =3D sendMessage (TV, TVM_DELETEITEM, 0, TVI_ROOT)
folders &=3D addTVItem( TV, closefolder, openfolder, "Windows 1", 0 )
folders &=3D addTVItem( TV, closefolder, openfolder, "DOS 2", 0 )
folders &=3D addTVItem( TV, closefolder, openfolder, "Linux 3", 0 )
folders &=3D addTVItem( TV, closefolder, openfolder, "Generic 4", 0 )
folders &=3D addTVItem( TV, closefolder, openfolder, "Library 5", =
folders[1] )
folders &=3D addTVItem( TV, closefolder, openfolder, "Games 6", =
folders[1] )
folders &=3D addTVItem( TV, closefolder, openfolder, "Library 7", =
folders[2] )
folders &=3D addTVItem( TV, closefolder, openfolder, "Games 8", =
folders[2] )
folders &=3D addTVItem( TV, closefolder, openfolder, "Library 9", =
folders[3] )
folders &=3D addTVItem( TV, closefolder, openfolder, "Games 10", =
folders[3] )
VOID =3D sendMessage( Win, WM_SETICON, 0, iExw)
lv =3D {
{ "Win32Lib", "David Cuny", win},
{ "Neil", "Pete Eberlein", dos},
{ "Exotica", "Todd Riggins", win},
{ "Object Euphoria", "Mike Nelson", generic },
{ "Low-level routines", "Bernie Ryan", win},
{ "Euphoria Database System", "RDS", generic},
{ "Remote Procedure Calls", "Pete Eberlein", linux },
{ "Magefire 3D", "Pete King", win },
{ "Euphoria CGI Setup", "Irv Mullins", linux},
{ "Simple Chess Program", "Normand Blaise", linux},
{ "NeilGUI","Lewis Townsend", dos},
{ "Spectre Setup", "Pete King", win},
{ "Saving Master Yoga", "Spocky", win},
{ "Associative Lists", "Jiri Babor", generic},
{ "Mini-Assembler", "Pete Eberlein", generic},
{ "MySQL for Euphoria", "Fabio Ramirez", win },
{ "File and Pipe Libraries", "Jeff Fielding", linux},
{ "X Windows GUI Library", "Irv Mullins", linux },
{ "Lemon Headz Game", "Liquid-Nitrogen", dos},
{ "Matheval", "Matt Lewis", generic}
}
location =3D repeat( 0, length( lv ) )
lParams =3D location
for i =3D 1 to length(location) do
location[i] =3D rand(6) + 4
end for
with trace
procedure droppedTV( integer id, sequence data )
atom item, ix
if id =3D LV then
item =3D hitTestTV( TV )
if item and item !=3D current then
for i =3D 1 to length(data) do =20
ix =3D find(data[i], lParams )
-- Move item to drop location
location[ix] =3D item
-- Remove from display
lParams[ix] =3D 0
ix =3D deleteItem( LV, data[i] )
end for
end if
end if
=20
end procedure
onDragAndDrop[TV ] =3D routine_id("droppedTV")
procedure TV_onChange( )
atom ix
=20
if deleteItem( LV, -1 ) then end if
lParams -=3D lParams
current =3D getIndex( TV )
-- show items
ix =3D 1
while ix <=3D length( location ) do
if location[ix] =3D current then
lParams[ix] =3D addLVItem( LV, lv[ix][3], lv[ix][1..2] )
end if
ix +=3D 1
end while
end procedure
onChange[TV] =3D routine_id( "TV_onChange" )
-- End Code
WinMain( Win, Normal )
------=_NextPart_000_0016_01C15C3A.E0D99920--
2. Re: Windows treeview bug!
24/10/2001 11:20:49 AM, tone.skoda at siol.net wrote:
>
>If Treeview is created with TVS_NOSCROLL style and all its items are deleted
>with
> sendMessage (TV, TVM_DELETEITEM, 0, TVI_ROOT)
>before items are inserted,
>then tree items are not visible until next time tree is resized.
>
>This is Windows bug, because I tried it with C++ program and it was the
>same.
>
>It was also very hard to discover.
>
>What to do :-o ???
Don't delete an item before any are inserted.
>
>Additional quesion:
>When's next release of Win32Lib and which version are we suposed to use now?
>I use alpha .56.
>
You can use any version you wish to.
The last stable one from me was 0.55.1.
Martin has submitted as 0.55.4
There is a buggy one from me called 0.56 alpha
The next edition from me will be a 0.56.1 alpha. I don't know when this will be
though.
So in summary, I recommend Martin's 0.55.4 as the least buggy version to date.
------------
Derek.
3. Re: Windows treeview bug!
- Posted by euman at bellsouth.net
Oct 23, 2001
I think you can force a repaint of the TV let me look into it since I too
currently have an issue with TVN_ITEMEXPANDING in API code.
Euman
euman at bellsouth.net
> If Treeview is created with TVS_NOSCROLL style and all its items are deleted
> with
> sendMessage (TV, TVM_DELETEITEM, 0, TVI_ROOT)
> before items are inserted,
> then tree items are not visible until next time tree is resized.
>
> This is Windows bug, because I tried it with C++ program and it was the
> same.
>
> It was also very hard to discover.
>
> What to do :-o ???
>
>
> Additional quesion:
> When's next release of Win32Lib and which version are we suposed to use now?
> I use alpha .56.
>
>
>
4. Re: Windows treeview bug!
- Posted by tone.skoda at siol.net
Oct 23, 2001
----- Original Message -----
From: Derek Parnell <ddparnell at bigpond.com>
Subject: Re: Windows treeview bug!
>
>
> 24/10/2001 11:20:49 AM, tone.skoda at siol.net wrote:
>
> >
> >If Treeview is created with TVS_NOSCROLL style and all its items are
deleted
> >with
> > sendMessage (TV, TVM_DELETEITEM, 0, TVI_ROOT)
> >before items are inserted,
> >then tree items are not visible until next time tree is resized.
> >
> >This is Windows bug, because I tried it with C++ program and it was the
> >same.
> >
> >It was also very hard to discover.
> >
> >What to do :-o ???
>
> Don't delete an item before any are inserted.
If I use
sendMessage (TV, TVM_DELETEITEM, 0, TVI_ROOT)
any time, regardless if there are any items or not, the bug happens.
In my program, I delete all items every time when a separate scroll is
scrolled and then insert new items.
5. Re: Windows treeview bug!
- Posted by tone.skoda at siol.net
Oct 23, 2001
I tried that, it doesn't work. But it works if I resize treeview after
inserting items, and even that not allways.
----- Original Message -----
From: <euman at bellsouth.net>
Subject: Re: Windows treeview bug!
>
> I think you can force a repaint of the TV let me look into it since I too
> currently have an issue with TVN_ITEMEXPANDING in API code.
>
> Euman
> euman at bellsouth.net
>
> > If Treeview is created with TVS_NOSCROLL style and all its items are
deleted
> > with
> > sendMessage (TV, TVM_DELETEITEM, 0, TVI_ROOT)
> > before items are inserted,
> > then tree items are not visible until next time tree is resized.
> >
> > This is Windows bug, because I tried it with C++ program and it was the
> > same.
> >
> > It was also very hard to discover.
> >
> > What to do :-o ???
> >
> >
> > Additional quesion:
> > When's next release of Win32Lib and which version are we suposed to use
now?
> > I use alpha .56.
> >
> >
>
>
6. Re: Windows treeview bug!
- Posted by euman at bellsouth.net
Oct 23, 2001
Have you also tried TreeView_EnsureVisible?
Euman
euman at bellsouth.net
> I tried that, it doesn't work. But it works if I resize treeview after
> inserting items, and even that not allways.
> >
> > I think you can force a repaint of the TV let me look into it since I too
> > currently have an issue with TVN_ITEMEXPANDING in API code.
> >
> > Euman
> > euman at bellsouth.net
> >
> > > If Treeview is created with TVS_NOSCROLL style and all its items are
> deleted
> > > with
> > > sendMessage (TV, TVM_DELETEITEM, 0, TVI_ROOT)
> > > before items are inserted,
> > > then tree items are not visible until next time tree is resized.
> > >
> > > This is Windows bug, because I tried it with C++ program and it was the
> > > same.
> > >
> > > It was also very hard to discover.
> > >
> > > What to do :-o ???
> > >
> > >
> > > Additional quesion:
> > > When's next release of Win32Lib and which version are we suposed to use
> now?
> > > I use alpha .56.
7. Re: Windows treeview bug!
- Posted by tone.skoda at siol.net
Oct 24, 2001
Tried TreeView_EnsureVisible, it doesn't fix it either.
But I have found a way to get around this bug:
Resizing treeview with:
setRect (treeview, x, y, cx, cy, repaint)
after items were deleted.
BUT:
previous size of treeview shouldnt be same to x, y, cx, cy!
This is clearly Windows treeview bug. This should be reported to someone in
Microsoft, right?
----- Original Message -----
From: <euman at bellsouth.net>
To: EUforum <EUforum at topica.com>
Sent: Wednesday, October 24, 2001 5:55 AM
Subject: Re: Windows treeview bug!
>
> Have you also tried TreeView_EnsureVisible?
>
> Euman
> euman at bellsouth.net
>
> > I tried that, it doesn't work. But it works if I resize treeview after
> > inserting items, and even that not allways.
> > >
> > > I think you can force a repaint of the TV let me look into it since I
too
> > > currently have an issue with TVN_ITEMEXPANDING in API code.
> > >
> > > Euman
> > > euman at bellsouth.net
> > >
> > > > If Treeview is created with TVS_NOSCROLL style and all its items are
> > deleted
> > > > with
> > > > sendMessage (TV, TVM_DELETEITEM, 0, TVI_ROOT)
> > > > before items are inserted,
> > > > then tree items are not visible until next time tree is resized.
> > > >
> > > > This is Windows bug, because I tried it with C++ program and it was
the
> > > > same.
> > > >
> > > > It was also very hard to discover.
> > > >
> > > > What to do :-o ???
> > > >
> > > >
> > > > Additional quesion:
> > > > When's next release of Win32Lib and which version are we suposed to
use
> > now?
> > > > I use alpha .56.
>
>
>