Discussion:
Listview LVS_ICON, LVS_AUTOARRANGE item ordering problem.
(too old to reply)
R.Wieser
2021-11-05 10:45:10 UTC
Permalink
Hello all,

Using XPsp3 I've got a SysListView32 element which I have given the LVS_ICON
and LVS_AUTOARRANGE settings. The thing is that even though I can see that
LVM_ADDITEM increments the items indices as expected what gets displayed is
rather random in its ordering.

I've tried to google the problem/cause/solution, but can't seem to find
anything (other than MS saying "Icons are automatically kept arranged in
icon and small icon view.")

Although I've found a "solution" by only enabeling the LVS_AUTOARRANGE
setting *after* I've loaded the items, I'm not at all sure if this willstick
for as long as the program stays open.

In other words : I've got no idea when the autoarrange will again activate
(on insertion ? Deletion ? Doesn't seem to on resizing, but it might ?)
and again make a mess of the items order.

Does anyone have some information on how/when autoarrange does its job and
get it to behave so the items stay in order as provided (thru LM_ADDITEM /
LVM_INSERITEM / others? )

Regards,
Rudy Wieser
JJ
2021-11-06 12:57:49 UTC
Permalink
Post by R.Wieser
Hello all,
Using XPsp3 I've got a SysListView32 element which I have given the LVS_ICON
and LVS_AUTOARRANGE settings. The thing is that even though I can see that
LVM_ADDITEM increments the items indices as expected what gets displayed is
rather random in its ordering.
I've tried to google the problem/cause/solution, but can't seem to find
anything (other than MS saying "Icons are automatically kept arranged in
icon and small icon view.")
Although I've found a "solution" by only enabeling the LVS_AUTOARRANGE
setting *after* I've loaded the items, I'm not at all sure if this willstick
for as long as the program stays open.
In other words : I've got no idea when the autoarrange will again activate
(on insertion ? Deletion ? Doesn't seem to on resizing, but it might ?)
and again make a mess of the items order.
Does anyone have some information on how/when autoarrange does its job and
get it to behave so the items stay in order as provided (thru LM_ADDITEM /
LVM_INSERITEM / others? )
Regards,
Rudy Wieser
It's just like the desktop's Auto Arrange. Meaning that, icons are always
(left side) arranged. LVS_AUTOARRANGE is not same as desktop's Align To
Grid.
R.Wieser
2021-11-06 19:00:00 UTC
Permalink
JJ,
Post by JJ
It's just like the desktop's Auto Arrange. Meaning that, icons are always
(left side) arranged.
Not quite. The default is "top side" (horizontal first) ordered, but you
can add the LVS_ALIGNLEFT flag to have it arrange "left side" (vertical
first).
Post by JJ
LVS_AUTOARRANGE is not same as desktop's Align To Grid.
Yes, I'm aware of that.

Alas, neither has anything to do with the ListView problem I described.

Mind you, it sometimes seems to work allright and all items are in the order
in which they where added to the ListView. I've got one program which
(currently!) seems to have no problem, and another which (now) every time
throws the items outof order.

The thing is that when I wait with setting the LVS_AUTOARRANGE until /after/
I've addded the items to the ListView the autoarranging (when I resize the
dialog and by it the ListView in it) seem to work flawlessly.

IOW, it looks like LVS_AUTOARRANGE doesn't like LVM_INSERTITEM (and perhaps
others too) very much.

Regards,
Rudy Wieser

Loading...