Re: [Pharo-users] Drag and drop items between list views

2014-04-07 Thread Benjamin
Ben On 07 Apr 2014, at 12:17, MartinW wrote: > Benjamin Van Ryseghem (Pharo) wrote >> Out of this thread, I have made this post: >> http://spec.st/docs/drag_n_drop/ >> With a small change in the Spec code base (to not sort by default, but >> only when a sorting block is specified), >> it gives

Re: [Pharo-users] Drag and drop items between list views

2014-04-07 Thread MartinW
Benjamin Van Ryseghem (Pharo) wrote > Out of this thread, I have made this post: > http://spec.st/docs/drag_n_drop/ > With a small change in the Spec code base (to not sort by default, but > only when a sorting block is specified), > it gives an example of how to do what you want :) Cool. Thank yo

Re: [Pharo-users] Drag and drop items between list views

2014-04-07 Thread Benjamin
Sorry for the delay, I turn off my emails during the week end :) Out of this thread, I have made this post: http://spec.st/docs/drag_n_drop/ With a small change in the Spec code base (to not sort by default, but only when a sorting block is specified), it gives an example of how to do what you wa

Re: [Pharo-users] Drag and drop items between list views

2014-04-04 Thread Goubier Thierry
Le 04/04/2014 12:04, MartinW a écrit : Goubier Thierry wrote By the way, any chance of having your code as an example for Spec? I went through the spec documentation and I couldn't see anything similar, and, from our difficulties to get that to work, I would guess a bit of work on Spec drag an

Re: [Pharo-users] Drag and drop items between list views

2014-04-04 Thread MartinW
Goubier Thierry wrote > By the way, any chance of having your code as an example for Spec? I > went through the spec documentation and I couldn't see anything similar, > and, from our difficulties to get that to work, I would guess a bit of > work on Spec drag and drop support could be a good th

Re: [Pharo-users] Drag and drop items between list views

2014-04-04 Thread MartinW
Goubier Thierry wrote > Yes, I've seen that. It's fine by me that the list displayed in the > widget is copied and sorted, just that I would have liked to be able to > touch the true collection hidden inside the ListModel. Unless the list > model is more like a ListAdaptor in meaning, in which c

Re: [Pharo-users] Drag and drop items between list views

2014-04-04 Thread Goubier Thierry
Le 04/04/2014 10:41, Benjamin a écrit : Why not, but this will not solve the issue :) I will probably fix that in the train today (5h long trip to Bordeaux ^^) . I'm nice to give you something to do during those 5 hours, then ;) The issue is that the items are sorted by default, which means

Re: [Pharo-users] Drag and drop items between list views

2014-04-04 Thread Benjamin
Why not, but this will not solve the issue :) I will probably fix that in the train today (5h long trip to Bordeaux ^^) . The issue is that the items are sorted by default, which means that the list is populated with a copy of the items provided. Maybe it should not :) Then for the convenient me

Re: [Pharo-users] Drag and drop items between list views

2014-04-04 Thread Goubier Thierry
Hi Ben, I think that hard-linking the collections inside the drop block isn't working in that case, so you have to write that without any reference to collection1 and collection2 :) But, since you're here: why don't I have an API to add or remove items from the ListModel instance? If I was w

Re: [Pharo-users] Drag and drop items between list views

2014-04-04 Thread Goubier Thierry
Le 03/04/2014 22:55, MartinW a écrit : Goubier Thierry wrote Another approach, that I would use, is to put more complex objects inside the lists. Thoses objects would know how to get added / removed from their respective collections, and then I would propagate collection changes to the ListMod

Re: [Pharo-users] Drag and drop items between list views

2014-04-03 Thread Benjamin Van Ryseghem
here is a "hackish" solution: collection1 := #(1 2 3 4 5) asOrderedCollection. collection2 := #($a $b $c $d $e) asOrderedCollection. list1 := ListModel new. list1 items: collection1. list1 dragEnabled: true. list1 dropEnabled: true. list1

Re: [Pharo-users] Drag and drop items between list views

2014-04-03 Thread MartinW
Goubier Thierry wrote > Another approach, that I would use, is to put more complex objects > inside the lists. Thoses objects would know how to get added / removed > from their respective collections, and then I would propagate collection > changes to the ListModel instances. That sounded promi

Re: [Pharo-users] Drag and drop items between list views

2014-04-03 Thread Goubier Thierry
Le 02/04/2014 20:44, MartinW a écrit : First of all thank you for taking the time to explain all this to me! I already learned a lot about working with the spec widgets.. You're giving me good code to work with, and the things I use are more Morphic than Spec, which is more in my circle of c

Re: [Pharo-users] Drag and drop items between list views

2014-04-02 Thread MartinW
First of all thank you for taking the time to explain all this to me! I already learned a lot about working with the spec widgets.. I still have a problem. The first version with the hardcoded collections did obviously change the original collections (that's the desired behaviour). Goubier Thierr

Re: [Pharo-users] Drag and drop items between list views

2014-04-02 Thread Goubier Thierry
Le 02/04/2014 17:40, MartinW a écrit : Thank you. This is a step forward. The thing is i can't hardcode the collections. In the end product i don't have two but seven lists, so i must be able to detect in the acceptDropBlock which is the receiving collection/list. Ok, the :source is your frie

Re: [Pharo-users] Drag and drop items between list views

2014-04-02 Thread Goubier Thierry
Le 02/04/2014 17:40, MartinW a écrit : Thank you. This is a step forward. The thing is i can't hardcode the collections. In the end product i don't have two but seven lists, so i must be able to detect in the acceptDropBlock which is the receiving collection/list. I'll try to redo a halt in t

Re: [Pharo-users] Drag and drop items between list views

2014-04-02 Thread MartinW
Thank you. This is a step forward. The thing is i can't hardcode the collections. In the end product i don't have two but seven lists, so i must be able to detect in the acceptDropBlock which is the receiving collection/list. Goubier Thierry wrote > Ok, look at that code: > > | collection1

Re: [Pharo-users] Drag and drop items between list views

2014-04-02 Thread Goubier Thierry
Ok, look at that code: | collection1 collection2 list1 list2 | collection1 := #(1 2 3 4 5) asOrderedCollection. collection2 := #($a $b $c $d $e) asOrderedCollection. list1 := ListModel new. list1 items: collection1. list1 dragEnabled: true.

Re: [Pharo-users] Drag and drop items between list views

2014-04-02 Thread MartinW
I tried the following, but i do not know what to do in the acceptDropBlock. It seems the receiver in the block is only an item in a list, but how do i get the receiving list/collection? What i want to achieve is that a user can drag the '1' from list1 to list2 and the resulting collections will the

Re: [Pharo-users] Drag and drop items between list views

2014-04-02 Thread Goubier Thierry
Hi Martin, yes, most list-like widgets can drag and drop. Feedback when inserting items in lists could be improved, however (i.e. you can drop on a list item, but I've never seen the feedback for dropping between list items). Thierry Le 02/04/2014 16:09, MartinW a écrit : Hi, i have to make

[Pharo-users] Drag and drop items between list views

2014-04-02 Thread MartinW
Hi, i have to make a UI where users can sort items (sentences) into different collections by dragging and dropping them between list views. Is this possible with the widgets currently available in Pharo? M. -- View this message in context: http://forum.world.st/Drag-and-drop-items-between-list-