Another question about Spec

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

Another question about Spec

Julien Delplanque
Hey,

I use drag and drop between two lists in a project and I read this
tutorial [1] to learn how to do it.

My question is: Is there a way to have another object than a String as
passengers in #acceptDropBlock: (I get passengers the same way as in the
tutorial i.e sending #passenger to transfer object) like the objects
really in the list? Because if I use #displayBlock: it became difficult
to be sure I retrieve the object I dropped in the source list...

Thanks in advance,

Julien

[1]: http://spec.st/docs/drag_n_drop/

Reply | Threaded
Open this post in threaded view
|

Re: Another question about Spec

jfabry

I don’t know the details of drag and drop, but it seems that you get the source widget as well as an argument of the block. From there you can get the selectedItem, which should be the one that you are dragging I suppose. Can you confirm that this works?

> On Feb 4, 2016, at 04:38, Julien Delplanque <[hidden email]> wrote:
>
> Hey,
>
> I use drag and drop between two lists in a project and I read this tutorial [1] to learn how to do it.
>
> My question is: Is there a way to have another object than a String as passengers in #acceptDropBlock: (I get passengers the same way as in the tutorial i.e sending #passenger to transfer object) like the objects really in the list? Because if I use #displayBlock: it became difficult to be sure I retrieve the object I dropped in the source list...
>
> Thanks in advance,
>
> Julien
>
> [1]: http://spec.st/docs/drag_n_drop/
>
>



---> Save our in-boxes! http://emailcharter.org <---

Johan Fabry   -   http://pleiad.cl/~jfabry
PLEIAD and RyCh labs  -  Computer Science Department (DCC)  -  University of Chile


Reply | Threaded
Open this post in threaded view
|

Re: Another question about Spec

Julien Delplanque
I understand what you say but sadly, it will not work in my case because:
     - I use #displayBlock:
     - Two or more items may be different objects but the result of the
display block is the same.

So I can't just use the string to retrieve the item in the list... :(

Julien

On 04/02/16 16:55, Johan Fabry wrote:

> I don’t know the details of drag and drop, but it seems that you get the source widget as well as an argument of the block. From there you can get the selectedItem, which should be the one that you are dragging I suppose. Can you confirm that this works?
>
>> On Feb 4, 2016, at 04:38, Julien Delplanque <[hidden email]> wrote:
>>
>> Hey,
>>
>> I use drag and drop between two lists in a project and I read this tutorial [1] to learn how to do it.
>>
>> My question is: Is there a way to have another object than a String as passengers in #acceptDropBlock: (I get passengers the same way as in the tutorial i.e sending #passenger to transfer object) like the objects really in the list? Because if I use #displayBlock: it became difficult to be sure I retrieve the object I dropped in the source list...
>>
>> Thanks in advance,
>>
>> Julien
>>
>> [1]: http://spec.st/docs/drag_n_drop/
>>
>>
>
>
> ---> Save our in-boxes! http://emailcharter.org <---
>
> Johan Fabry   -   http://pleiad.cl/~jfabry
> PLEIAD and RyCh labs  -  Computer Science Department (DCC)  -  University of Chile
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Another question about Spec

Julien Delplanque
In reply to this post by jfabry
Oh, I realize I didn't read your mail correctly, I'm sorry.

I will try this trick.

Julien

On 04/02/16 16:55, Johan Fabry wrote:

> I don’t know the details of drag and drop, but it seems that you get the source widget as well as an argument of the block. From there you can get the selectedItem, which should be the one that you are dragging I suppose. Can you confirm that this works?
>
>> On Feb 4, 2016, at 04:38, Julien Delplanque <[hidden email]> wrote:
>>
>> Hey,
>>
>> I use drag and drop between two lists in a project and I read this tutorial [1] to learn how to do it.
>>
>> My question is: Is there a way to have another object than a String as passengers in #acceptDropBlock: (I get passengers the same way as in the tutorial i.e sending #passenger to transfer object) like the objects really in the list? Because if I use #displayBlock: it became difficult to be sure I retrieve the object I dropped in the source list...
>>
>> Thanks in advance,
>>
>> Julien
>>
>> [1]: http://spec.st/docs/drag_n_drop/
>>
>>
>
>
> ---> Save our in-boxes! http://emailcharter.org <---
>
> Johan Fabry   -   http://pleiad.cl/~jfabry
> PLEIAD and RyCh labs  -  Computer Science Department (DCC)  -  University of Chile
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Another question about Spec

Julien Delplanque
Ok, I just tried what you said and it does not always works
since it is possible to drag an item from the list without selecting it...

Julien

On 04/02/16 17:42, Julien Delplanque wrote:

> Oh, I realize I didn't read your mail correctly, I'm sorry.
>
> I will try this trick.
>
> Julien
>
> On 04/02/16 16:55, Johan Fabry wrote:
>> I don’t know the details of drag and drop, but it seems that you get
>> the source widget as well as an argument of the block. From there you
>> can get the selectedItem, which should be the one that you are
>> dragging I suppose. Can you confirm that this works?
>>
>>> On Feb 4, 2016, at 04:38, Julien Delplanque <[hidden email]> wrote:
>>>
>>> Hey,
>>>
>>> I use drag and drop between two lists in a project and I read this
>>> tutorial [1] to learn how to do it.
>>>
>>> My question is: Is there a way to have another object than a String
>>> as passengers in #acceptDropBlock: (I get passengers the same way as
>>> in the tutorial i.e sending #passenger to transfer object) like the
>>> objects really in the list? Because if I use #displayBlock: it
>>> became difficult to be sure I retrieve the object I dropped in the
>>> source list...
>>>
>>> Thanks in advance,
>>>
>>> Julien
>>>
>>> [1]: http://spec.st/docs/drag_n_drop/
>>>
>>>
>>
>>
>> ---> Save our in-boxes! http://emailcharter.org <---
>>
>> Johan Fabry   -   http://pleiad.cl/~jfabry
>> PLEIAD and RyCh labs  -  Computer Science Department (DCC)  -
>> University of Chile
>>
>>
>