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)
Ha ha! Trick question! SproutCore is a client-side application framework
(unlike, say, Google Web Toolkit).
No part of SproutCore “runs” on the server, and SproutCore contains no
“server-side” libraries. A web server (Apache, for example) is only used
initial files have been served, a SproutCore-based application runs entirely
in the browser (and can easily be run “offline”, with no network access
Any server that can receive HTTP requests (which is all of them) can
interact with a running SproutC... (more)
Making sure your apps work everywhere is an important part of any mobile
strategy. The mobile web allows you to reach your users wherever they are,
and users have grown to expect that you’ll be there wherever they go.
Increasingly, users want to access applications through app stores; to reach
your users, you have to be available to them as many ways as possible.
PhoneGap allows you to put your web applications in a native wrapper and
deliver them in the Apple App Store, Android Marketplace, and many other
native app stores. It also integrates really well with SproutCore, making i... (more)
The first patch release of SproutCore 1.10 is now available. This update
includes the following fixes:
Allows inline text fields to work with automatic child view layout. Fixed
SC.Module loading for IE11 and future versions. Fixed SC.Drag cancellation
with the Escape key to call dragEnded for cleanup. Added a retina image for
the default theme of SC.MenuPane. Fixed the touch selection of
SC.CollectionView to prevent an item from appearing deselected when touched
twice in a row. Fixed the insertion point code for SC.GridView in order to
show an insertion view when dragging and dr... (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)