Paris SproutCore Meetup

written by SproutCore

We’re having a SproutCore meetup in Paris on **Tuesday, August 3th at 8:00 pm (EDIT: we originally planned to do it on the 5th but we had to reschedule)**. Charles, the creator of SproutCore, will be here, as well as members of the core team. Whether you’re already familiar with the framework of just curious to know more about it, join us for a beer at the [Café Léa](http://maps.google.com/places/fr/paris/rue-claude-bernard/5/-chez-l%C3%A9a).

Hope to see you there!

SproutCore/WWDC Meetup 2010

written by SproutCore

The SproutCore Team is getting together tomorrow night in San Francisco for dinner and drinks following the last WWDC session.  This is really informal meeting this year, but if you want to see the core team and chat, signup here:

SproutCore Meetup Eventbrite

We will confirm a location tonight based on the number of RSVPs at 6pm Pacific Today.  Hope to see you there!

SproutCore at Velocity Fall 09

written by SproutCore

Link: SproutCore at Velocity Fall 09

Just a reminder – I will be talking about some of the new loading techniques we are working on for SproutCore 1.1 at Velocity Only Fall next Tuesday, Dec 8.

The conference is online – which means you can attend from your own desk.  Why travel when you know you’d just spend the time hacking on your laptop anyway.  Hack and listen from the comfort of your own desk!

If you’re interested in attending (all the other talks are great too) you can get a 25% discount using the code velfall09sdc

Event Handling in SproutCore 1.0 – Part 2 – Dragging a View

written by SproutCore

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 tighter control.

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 the mouse is moved while the button is pressed.  This is only called if you returned YES from mouseDown().
  • mouseUp() – Called when the mouse button is released.  Only called if you returned YES from mouseDown().
  • mouseOver() – Called when the mouse enters the view’s visible area.
  • mouseOut() – Called when the mouse leaves the view’s visible area.
  • mouseMoved() – Called whenever the mouse is moved while over the view.

It’s important to note that all of these events, except for mouseDragged() and mouseUp() are sent first to the view that is directly under the mouse pointer at the time of the event.  mouseDragged() and mouseUp() only happen after a mouseDown() event.  They are always sent first to the view that implemented mouseDown() AND returned YES (or true) from that method.

Events do bubble up your view hierarchy using something called a Responder Chain, but that will be the subject for another post.

Event handler methods are always passed an SC.Event object describing the event.  This class provides a consistent cross-platform API for accessing event info.  In general, it follows the API conventions for the built-in Event object on Firefox.


Continue reading