Using multiple channels for events

87 views
Skip to first unread message

André Moraes

unread,
May 9, 2012, 2:49:28 PM5/9/12
to go-...@googlegroups.com
Just an proposition, but maybe instead of a single channel for events, why not use one channel for each kind of event.

So, instead of wd.Window having a single EventChan() method, it had:

MouseEvents()
KeybordEvents()
SystemEvents()

The first problem that I see is how to handle a mouse move simultaneous to a Keyboard keydown, currenctly on most systems those events are pushed into a queue and handled one at time.

John Asmuth

unread,
May 9, 2012, 2:55:56 PM5/9/12
to go-...@googlegroups.com
The thing you suggest is straight forward to implement on your own. go.wde is meant to be the absolute barest possible bones. More interesting layers like what you talk about can be built on top.

--
You received this message because you are subscribed to the Google Groups "go-uik" group.
To view this discussion on the web visit https://groups.google.com/d/msg/go-uik/-/sBJdvqa7Vd4J.
To post to this group, send email to go-...@googlegroups.com.
To unsubscribe from this group, send email to go-uik+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/go-uik?hl=en.

André Moraes

unread,
May 9, 2012, 3:37:59 PM5/9/12
to go-...@googlegroups.com
But it's an intresting idea? I was more asking for comments about that than requesting that to go into go.uik :)

John Asmuth

unread,
May 9, 2012, 5:26:04 PM5/9/12
to go-...@googlegroups.com
Gotcha.

It's actually something I experimented with in the early (or earlier, anyway) stages of uik. I felt it made the internal API too difficult to work with - having a single channel that you type switch off instead of many channels that you select{} on makes it easier to forward the event to, for instance, an embedded type. Like, a widget will forward an event to Block.HandleEvent() in the default case. With select, there is a lot more overhead, both typing and runtime.

Moving back to the single-channel/switch{} strategy simplified a lot of code.

On Wed, May 9, 2012 at 3:37 PM, André Moraes <and...@gmail.com> wrote:
But it's an intresting idea? I was more asking for comments about that than requesting that to go into go.uik :)

--
You received this message because you are subscribed to the Google Groups "go-uik" group.
To view this discussion on the web visit https://groups.google.com/d/msg/go-uik/-/lmdYRJ6BIZEJ.

André Moraes

unread,
May 10, 2012, 8:38:03 AM5/10/12
to go-...@googlegroups.com

Thanks
Reply all
Reply to author
Forward
0 new messages