How to set a list item screen position?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

How to set a list item screen position?

Maxim Fridental
I'm trying the following:

listView := ListView show.
listView viewMode: #largeIcons.
listView model: #('first item' 'second item').
listView lvmSetItem: 1 position: (listView lvmGetItemPosition: 0).

It doesn't work; the item position doesn't change and the SendMessage in
#lvmSetItem:position: returns FALSE.
Please help.


Best Regards,
Maxim Fridental


Reply | Threaded
Open this post in threaded view
|

Re: How to set a list item screen position?

Ian Bartholomew-18
Maxim,

> I'm trying the following:
>
> listView := ListView show.
> listView viewMode: #largeIcons.
> listView model: #('first item' 'second item').
> listView lvmSetItem: 1 position: (listView lvmGetItemPosition: 0).

Do you just want to change the order of the icons or do you want the
ability to place them in arbitrary positions within the view?

--
Ian

Use the Reply-To address to contact me.
Mail sent to the From address is ignored.


Reply | Threaded
Open this post in threaded view
|

Re: How to set a list item screen position?

Maxim Friedental
Ian,

> Do you just want to change the order of the icons or do you want the
> ability to place them in arbitrary positions within the view?
The latter. Actually we want to give the user the ability to manually
arrange items in a list view, as Windows Explorer in the large or small
icons mode does.

Best Regards,
Maxim Fridental


Reply | Threaded
Open this post in threaded view
|

Re: How to set a list item screen position?

Ian Bartholomew-18
Maxim,

> The latter. Actually we want to give the user the ability to manually
> arrange items in a list view, as Windows Explorer in the large or
> small icons mode does.

I can't help much but I think I can tell you why your example doesn't
work.  A quick dig on MSDN came up with the following table that is
applicable if the ListView uses the LVS_OWNERDATA style - which Dolphin
does, see ListView>>defaultWindowStyle.

MSDN says (excuse the reformatting but note the LVS_SETITEMPOSITION
entry)
-=-=-=-=-=-=-=-=-=-=-
Most list-view control messages and the associated macros are fully
supported. However, some messages have limitations or are unsupported
when you use the LVS_OWNERDATA style. The following table summarizes the
affected messages.

      Message Limitation
      LVM_ARRANGE Does not support the LVA_SNAPTOGRID style.
      LVM_DELETEALLITEMS Sets the item count to zero and clears all
internal selection variables, but it does not actually delete any items.
It makes a notification callback.
      LVM_DELETEITEM Is supported for selection integrity only and does
not actually delete an item.
      LVM_GETITEMSTATE Returns only focus and selection states (that is,
those states stored by the list-view control).
      LVM_GETNEXTITEM Does not support the list-view search criteria
LVNI_CUT, LVNI_HIDDEN, or LVNI_DROPHILITED. All other criteria are
supported.
      LVM_GETWORKAREAS Is not supported.
      LVM_INSERTITEM Is supported for selection integrity only.
      LVM_SETITEM Is not supported. To set the item state, use the
ListView_SetItemState message.
      LVM_SETITEMCOUNT Sets the number of items currently in the list.
If the list-view control sends a notification that requests data for any
item up to the maximum set, the owner must be prepared to supply that
data. The message parameters support virtual list-view controls.
      LVM_SETITEMPOSITION Is not supported.
      LVM_SETITEMSTATE Allows only the selection and focus states to be
changed for the item.
      LVM_SETITEMTEXT Is not supported. It is the application's
responsibility to maintain the item texts.
      LVM_SETWORKAREAS Is not supported.
      LVM_SORTITEMS Is not supported. It is the application's
responsibility to present the items in the desired order.
-=-=-=-=-=-=-=-=-=-=-

Temporarily removing the LVS_OWNERDATA style from ListView allows the
following to work as expected.

listView := ListView show.
listView viewMode: #largeIcons.
listView model: (ListModel on: #('first item' 'second item')).
listView lvmSetItem: 1 position: 100@100

--
Ian

Use the Reply-To address to contact me.
Mail sent to the From address is ignored.


Reply | Threaded
Open this post in threaded view
|

Re: How to set a list item screen position?

Chris Uppal-3
Ian, Maxim,

You can also turn off the LVS_OWNERDATA style by making the ListView
non-virtual.  The following works out of the box.

    listView := ListView show.
    listView isVirtual: false.            "<<-- here"
    listView viewMode: #largeIcons.
    listView model: (ListModel on: #('first item' 'second item')).
    listView lvmSetItem: 1 position: 100@100.

    -- chris


Reply | Threaded
Open this post in threaded view
|

Re: How to set a list item screen position?

Maxim Fridental
In reply to this post by Ian Bartholomew-18
Thank you Ian! That was the piece of information I've missed.

"Ian Bartholomew" <[hidden email]> wrote in
news:bv5hfl$oamkg$[hidden email]...

> Maxim,
>
> > The latter. Actually we want to give the user the ability to manually
> > arrange items in a list view, as Windows Explorer in the large or
> > small icons mode does.
>
> I can't help much but I think I can tell you why your example doesn't
> work.  A quick dig on MSDN came up with the following table that is
> applicable if the ListView uses the LVS_OWNERDATA style - which Dolphin
> does, see ListView>>defaultWindowStyle.
>
> MSDN says (excuse the reformatting but note the LVS_SETITEMPOSITION
> entry)
> -=-=-=-=-=-=-=-=-=-=-
> Most list-view control messages and the associated macros are fully
> supported. However, some messages have limitations or are unsupported
> when you use the LVS_OWNERDATA style. The following table summarizes the
> affected messages.
>
>       Message Limitation
>       LVM_ARRANGE Does not support the LVA_SNAPTOGRID style.
>       LVM_DELETEALLITEMS Sets the item count to zero and clears all
> internal selection variables, but it does not actually delete any items.
> It makes a notification callback.
>       LVM_DELETEITEM Is supported for selection integrity only and does
> not actually delete an item.
>       LVM_GETITEMSTATE Returns only focus and selection states (that is,
> those states stored by the list-view control).
>       LVM_GETNEXTITEM Does not support the list-view search criteria
> LVNI_CUT, LVNI_HIDDEN, or LVNI_DROPHILITED. All other criteria are
> supported.
>       LVM_GETWORKAREAS Is not supported.
>       LVM_INSERTITEM Is supported for selection integrity only.
>       LVM_SETITEM Is not supported. To set the item state, use the
> ListView_SetItemState message.
>       LVM_SETITEMCOUNT Sets the number of items currently in the list.
> If the list-view control sends a notification that requests data for any
> item up to the maximum set, the owner must be prepared to supply that
> data. The message parameters support virtual list-view controls.
>       LVM_SETITEMPOSITION Is not supported.
>       LVM_SETITEMSTATE Allows only the selection and focus states to be
> changed for the item.
>       LVM_SETITEMTEXT Is not supported. It is the application's
> responsibility to maintain the item texts.
>       LVM_SETWORKAREAS Is not supported.
>       LVM_SORTITEMS Is not supported. It is the application's
> responsibility to present the items in the desired order.
> -=-=-=-=-=-=-=-=-=-=-
>
> Temporarily removing the LVS_OWNERDATA style from ListView allows the
> following to work as expected.
>
> listView := ListView show.
> listView viewMode: #largeIcons.
> listView model: (ListModel on: #('first item' 'second item')).
> listView lvmSetItem: 1 position: 100@100
>
> --
> Ian
>
> Use the Reply-To address to contact me.
> Mail sent to the From address is ignored.
>


Reply | Threaded
Open this post in threaded view
|

Re: How to set a list item screen position?

Ian Bartholomew-18
In reply to this post by Chris Uppal-3
Chris,

> You can also turn off the LVS_OWNERDATA style by making the ListView
> non-virtual.  The following works out of the box.

I'd completely forgotton that you can use ListView in a non virtual
mode - it's not something I've ever felt the need to do.  As long as
Maxim doesn't want to display a large number of items, and as he is
using large icons I very much doubt that he does, then #isVirtual:
should solve the problem.

--
Ian

Use the Reply-To address to contact me.
Mail sent to the From address is ignored.