In my last post I introduced event delegation in SproutCore and the basics of
how to handle events. In this post I’m going to build on this foundation
to show you how you can add event handlers to drag a view around the window.*
Introducing the Mouse Events
As I noted in the first post, SproutCore recognizes several different types
of mouse events. Most of these events are essentially the same events sent
by most browsers, though some differ significantly in order to give you
Remember that to listen for events, you just need to add a method to your
view with the same name. Here is a quick rundown of the different methods
you can add to your view:
mouseDown() - Called when the mouse button is pressed while over your view.
You must return YES (i.e. true) from this method for mouseDragged() or
mouseUp() to be called. mouseDragged() - Called when t... (more)
“From where we sit now, the code is shaping up quite nicely. Soon enough,
if you have a SproutCore app, you’ll be able to just drop an editor right
into your app. As of today, anyone with a website can grab a copy of Bespin
and include the editor component very simply in their pages. We figure that
we’ve got another month of work to do before we’re ready to update
bespin.mozilla.com. We have a whole bunch of features to port over from the
old code and we need to make good on another big part of the Reboot promise:
opening Bespin up for plugins. It’s been hard even for Bespin core... (more)
The next release candidate for 1.11.0 will be out very shortly, but I thought
it best to post a brief update on the past week’s work as this week saw a
concentrated effort on core optimization.
First we took another look at the use of arguments lists throughout the
framework and found several more occurrences of it being accessed in an
inefficient manner. Depending on the browser, accessing arguments in such a
way that causes it to be allocated can be up to 80% slower and so it’s
really good to have these all fixed.
The other piece of optimization work undertaken has been much mo... (more)
One of the coolest parts of the new SproutCore View layer is its ability to
use aspect-based programming to add behaviors to views.
Aspect-based programming is built on the premise that often objects that
don’t follow from the same class hierarchy may in fact need similar
This is especially true in GUI programming when designers come to you and say
something like “I came up with this new widget - it looks kind of like a
progress bar but it acts like a button when you click on it”.
In SproutCore, you capture these common behaviors in a “mixin”. A mixin
is just a colle... (more)
SOA & WOA Magazine
Bruz Marzolf is writing a series of blog posts implementing a simple time
tracking app in various client-side rich web app frameworks. He just finished
his example in SproutCore and including some source code.
Here’s what he had to say:
SproutCore provides a higher level abstraction that manages when objects are
changed and need to be updated, and when they’re busy and shouldn’t be
modified, for instance.
Bruz’ code is a good example of a basic starter app that’s a little more
complex than our todos demo. I’m looking forward to his additional entries
in this s... (more)