spec and double click

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

spec and double click

Lorenz Köhl
I have a ListComposableModel rendered with spec that I want to do something if an element is double clicked.

        How do I register the event handler? I know about on:send:to but what Announcement do I use? In my testing with just a symbol #doubleClick it doesn't work (and probably isn't supposed to).

thanks,
        Lo
Reply | Threaded
Open this post in threaded view
|

Re: spec and double click

Stéphane Ducasse
>
> I have a ListComposableModel rendered with spec that I want to do something if an element is double clicked.

for double clicked I do not know.
Did you check the when* API of ListComposableModel?
>
> How do I register the event handler? I know about on:send:to

when:send:to:

> but what Announcement do I use? In my testing with just a symbol #doubleClick it doesn't work (and probably isn't supposed to).

In which Pharo version are you?

>
> thanks,
> Lo


Reply | Threaded
Open this post in threaded view
|

Re: spec and double click

Lorenz Köhl
> Did you check the when* API of ListComposableModel?

Yes,  the closest thing might be whenSelectionChanged but nothing regarding click events as I see it.

>>
>> How do I register the event handler? I know about on:send:to
>
> when:send:to:

In my ComposableModel the ListComposable model is 'attributes' so I did in initializeWidgets:

        attributes when: #doubleClick send: #onDoubleClick to: self.

where the method logs to the transcript. But nothing shows up on a double click.

I suspect that spec has to setup the morphs it creates for handling (double)clicks and maybe it doesn't?

> In which Pharo version are you?
        Latest 2.0

greetings,
        Lo


Reply | Threaded
Open this post in threaded view
|

Re: spec and double click

Stéphane Ducasse

On Nov 23, 2013, at 6:55 PM, Lorenz Köhl <[hidden email]> wrote:

>> Did you check the when* API of ListComposableModel?
>
> Yes,  the closest thing might be whenSelectionChanged but nothing regarding click events as I see it.
>
>>>
>>> How do I register the event handler? I know about on:send:to
>>
>> when:send:to:
>
> In my ComposableModel the ListComposable model is 'attributes' so I did in initializeWidgets:
>
> attributes when: #doubleClick send: #onDoubleClick to: self.
>
> where the method logs to the transcript. But nothing shows up on a double click.
>
> I suspect that spec has to setup the morphs it creates for handling (double)clicks and maybe it doesn't?
>
>> In which Pharo version are you?
> Latest 2.0

I strongly suggest to use 30 because spec changed a lot.

>
> greetings,
> Lo
>
>


Reply | Threaded
Open this post in threaded view
|

Re: spec and double click

Lorenz Köhl
> I strongly suggest to use 30 because spec changed a lot.

Doesn't seem to work either (on yesterdays 30):

| m |
m := ListModel new items: #(a b c).
m when: #doubleClick send: #traceCr to: Transcript.
m on: #doubleClick send: #traceCr to: Transcript.
 "need doubleclick announcement?"
m openWithSpec

Maybe there's some spec mechanism for adding the EventHandler stuff
to the morphs it creates?

greetings,
        Lo


Reply | Threaded
Open this post in threaded view
|

Re: spec and double click

Benjamin Van Ryseghem (Pharo)
m := NewListModel new
m doubleClickAction: [ self halt ]

m openWithSpec


This should work

Ben

On 23 Nov 2013, at 19:23, Lorenz Köhl <[hidden email]> wrote:

I strongly suggest to use 30 because spec changed a lot.

Doesn't seem to work either (on yesterdays 30):

| m |
m := ListModel new items: #(a b c).
m when: #doubleClick send: #traceCr to: Transcript.
m on: #doubleClick send: #traceCr to: Transcript.
"need doubleclick announcement?"
m openWithSpec

Maybe there's some spec mechanism for adding the EventHandler stuff
to the morphs it creates?

greetings,
Lo



Reply | Threaded
Open this post in threaded view
|

Re: spec and double click

Lorenz Köhl

On Nov 23, 2013, at 7:37 PM, Benjamin <[hidden email]> wrote:

> m := NewListModel new
> m doubleClickAction: [ self halt ]
>
> m openWithSpec

your code and the following (double clicking the list items) doesn't work for me in Pharo3.0
Latest update: #30591

m := NewListModel new items: #(a b c).
m doubleClickAction: [ Transcript traceCr: 'foo' ].
m openWithSpec
Reply | Threaded
Open this post in threaded view
|

Re: spec and double click

Benjamin Van Ryseghem (Pharo)
I will have a look tomorrow :)

If you are in a hurry, I know such a behaviour is present in EyeInspector

Ben

On 24 Nov 2013, at 00:07, Lorenz Köhl <[hidden email]> wrote:


On Nov 23, 2013, at 7:37 PM, Benjamin <[hidden email]> wrote:

m := NewListModel new
m doubleClickAction: [ self halt ]

m openWithSpec

your code and the following (double clicking the list items) doesn't work for me in Pharo3.0
Latest update: #30591

m := NewListModel new items: #(a b c).
m doubleClickAction: [ Transcript traceCr: 'foo' ].
m openWithSpec

Reply | Threaded
Open this post in threaded view
|

Re: spec and double click

Lorenz Köhl

> If you are in a hurry, I know such a behaviour is present in EyeInspector

Thanks. I found handlesDoubleClick: true there and it works now

Lo