Just don't get locked into a bad design decision by making developers handle raw keycodes for text input.
I've got a basic text entry widget, it seems to be working pretty well. Hopefully someone else can figure out how to interact with the copy/paste system...
This merits some planning. Do you ever visit #go-nuts on irc.freenode.net?
In response to your statement: "is it worth it to create a whole new slew of events? ForwardWordEvent, EndLineEvent?"
I believe these events shouldn't be generated in wde. Say a developer is writing a game with go.uik. Let's say the sprite walks forward with the right arrow key, and the developer wants the sprite to run when pressing alt+right_arrow. Does that mean he would need to catch a ForwardWordEvent? That's kinda out of left field.
The more I think about it, I don't like the idea of go.wde firing any widget specific events. That should be reserved for each individual widget in go.uik to implement. I'm trying to keep things simple here, just like in Rob Pike's paper (http://doc.cat-v.org/bell_labs/concurrent_window_system/concurrent_window_system.pdf) where each client has two incoming channels, one for the keyboard and one for the mouse. I feel that having go.wde capable of firing off dozens of different event types greatly muddies the elegance of that simple design. I believe that go.uik widgets should receive raw keyboard events and fire off (or call) appropriate events. For example, the text and entry widgets could receive the raw KeyDown events (or KeyTypedEvents), and internally they generate the proper cursor movement events, or cut/paste events, or undo/redo events, etc. Since we do like to keep all system dependent stuff in go.wde, we could still put all the mapping stuff in go.wde, although invoking it from go.uik. Pasting in entry.go would end up looking this:
case ev := <-e.UserEvents:
switch ev := ev.(type) {
case uik.KeyTypedEvent:
if ev.Chord == wde.PasteChord {
paste()
}
}
}
On a separate note, the more I consider your top-down approach to how events fire, the more I like it. In Rob Pike's paper, he speaks of every window in his windowing system only needing to accept two channels, the keyboard channel and mouse channel. It's so easy to plug into the system in fact, he says that it'd be trivial to embed another entire instance of the windowing system within a window. With this in mind, we're taking this design one step further with our widgets. We can embed our widgets within other widgets, as long as they accept and respond to our event channels. Any events not caught by Cocoa (when on Mac) will be passed to our window. Any events not caught by the window, will be passed on to the (for example) tab widget. Events not caught by the tab widget will be passed to (for example) the text widget. :)