Roassal observing click on any and all elements

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

Roassal observing click on any and all elements

Peter Uhnak
Hi Alex,

I'm trying to find a way how to observe all mouse clicks regardless of elements. I can do this easily on my side, because I have control over everything I create,
but doing that would prevent certain things like RTResizable from working in pure Roassal...

Currently all Trachel mouse events are created in Morphic (TRMorph), however events themselves are fired from shapes' announcers so there is no convergence point.

So, would it be possible to basically fire the event twice, once from the shape's announcer and once from probably view or canvas (or some TROverseer class or whatever).

As far as performance goes this shouldn't be a problem if you consider that just mouse movement can trigger 10 events every second.

What do you think? Is it worth for you to change/implement it?
If not I will resolve it on my side.

Thanks,
Peter

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Roassal observing click on any and all elements

abergel
Hi!

Having this overseer will indeed address some problems. For example, clicking on a background to remove all the resize handle. I have just implemented something:

        c := TRCanvas new.
        s := TRBoxShape new size: 50.
        c addShape: s.
        click := 0.
        s when: TRMouseClick do: [ :evt | click := click + 1 ].

        eo := TREventOverseer new.
        events := OrderedCollection new.
        eo block: [ :anEvent | events add: anEvent ].
        c eventOverseer: eo.
        c

I think you will need more. Probably that you do not want to capture all the event right? In particular, MouseMove is probably not interesting for you.

Feel free to extend TREventOverseer as you wish.

Cheers,
Alexandre


> On Jul 25, 2015, at 4:38 PM, Peter Uhnák <[hidden email]> wrote:
>
> Hi Alex,
>
> I'm trying to find a way how to observe all mouse clicks regardless of elements. I can do this easily on my side, because I have control over everything I create,
> but doing that would prevent certain things like RTResizable from working in pure Roassal...
>
> Currently all Trachel mouse events are created in Morphic (TRMorph), however events themselves are fired from shapes' announcers so there is no convergence point.
>
> So, would it be possible to basically fire the event twice, once from the shape's announcer and once from probably view or canvas (or some TROverseer class or whatever).
>
> As far as performance goes this shouldn't be a problem if you consider that just mouse movement can trigger 10 events every second.
>
> What do you think? Is it worth for you to change/implement it?
> If not I will resolve it on my side.
>
> Thanks,
> Peter
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev

--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.




_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Roassal observing click on any and all elements

Peter Uhnak
Perfect!

I've subclassed TREventOverseer to be able to use Announcer instead of block: [].
But it works just as I wanted. :)

Since I now use announcer I can easily do

overseer when: TRMouseLeftClick do: [ :event | ] .... and thus I do not need to filter MouseMove at all.

Thanks again!

Peter

(if you want to look at the overseer, it's as always at http://smalltalkhub.com/#!/~peteruhnak/roassal-contrib )

On Sat, Jul 25, 2015 at 10:31 PM, Alexandre Bergel <[hidden email]> wrote:
Hi!

Having this overseer will indeed address some problems. For example, clicking on a background to remove all the resize handle. I have just implemented something:

        c := TRCanvas new.
        s := TRBoxShape new size: 50.
        c addShape: s.
        click := 0.
        s when: TRMouseClick do: [ :evt | click := click + 1 ].

        eo := TREventOverseer new.
        events := OrderedCollection new.
        eo block: [ :anEvent | events add: anEvent ].
        c eventOverseer: eo.
        c

I think you will need more. Probably that you do not want to capture all the event right? In particular, MouseMove is probably not interesting for you.

Feel free to extend TREventOverseer as you wish.

Cheers,
Alexandre


> On Jul 25, 2015, at 4:38 PM, Peter Uhnák <[hidden email]> wrote:
>
> Hi Alex,
>
> I'm trying to find a way how to observe all mouse clicks regardless of elements. I can do this easily on my side, because I have control over everything I create,
> but doing that would prevent certain things like RTResizable from working in pure Roassal...
>
> Currently all Trachel mouse events are created in Morphic (TRMorph), however events themselves are fired from shapes' announcers so there is no convergence point.
>
> So, would it be possible to basically fire the event twice, once from the shape's announcer and once from probably view or canvas (or some TROverseer class or whatever).
>
> As far as performance goes this shouldn't be a problem if you consider that just mouse movement can trigger 10 events every second.
>
> What do you think? Is it worth for you to change/implement it?
> If not I will resolve it on my side.
>
> Thanks,
> Peter
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev

--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.




_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev