The Mouse Wheel in OpenLaszlo

In OpenLaszlo, scrollbars don’t automatically scroll with the mouse wheel. I guess the reason behind this is that scrollbars are very free-form. As a developer, you can make anything scroll, so it would be restrictive if the scrollbars were to respond to mouse wheel events in a predefined way.

To see how to use a scrollbar in OpenLaszlo, see my earlier post on the subject.

It’s really easy to trap mouse wheel events in OpenLaszlo. All you do is listen for the onmouswheeldelta event from the LzKeys service. That’s also the service that sends global keyboard events, by the way. The onmouswheeldelta event sends an argument, which tells you how much the wheel moved, and in what direction (it’s either a positive or a negative number).

To tie this to a scrollbar, you probably want to ensure that the mouse is actually overing above the view you want to scroll. Again, in OpenLaszlo, that’s really easy. There’s a containsPt() method on view, that tells you whether a given point (x,y) is within that view’s coordinate space. And to find the mouse position in a given views coordinate space, you simply call:

LzView.getMouse(“x”) and LzView.getMouse(“y”)

So here’s the application in action. Note that you might need to bring focus from the browser to the SWF by clicking once on the SWF:

Enjoy! (Here's the source to a Mouse Wheel Example).

OpenLaszlo 4.0.3 Released… stretches, and mini-me!

Last week, OpenLaszlo 4.0.3 was released (without much fanfair, since it’s a bugfix release). One little-noticed bug that I’m happy to see fixed is the stretches attribute.

The stretches attribute lets you stretch a resource to fit the view it’s attached to. The thing is, that stretches was always supposed to adjust the view’s entire coordinate space relative to the size of the image.

To see what I mean, play around with the larger window below:

Notice how the contents of that window - the resource and the smaller window - all resize simultaneously. I'm not sure of the practical applications of this yet, but it makes for a nice effect.

You can download the source for the above application if you like. Remember to compile in OpenLaszlo 4.0.3.

San Francisco Meet Up Update

Last Thursday Laszlo sponsored a developer meet up at Cellspace in San Francisco, CA. Laszlo Systems pays for the space, pizza and beer at these events, but the real content is provided by developers from the OpenLaszlo Community.

  • Gordon Tian, from myDecide presented DecisionStreet, an application that helps seniors and their families make important life decisions. There will be a publicly-available demo on the company’s site soon. Gordon took my Laszlo Training classes some time ago. By the time the classes were over, he had completed a fully-functional prototype of their application. It was impressive to see Gordon’s progress each morning at the start of class (he’d work on his application in the evenings), and I was thrilled to see the completed application now.
  • Vandana and Manoj Gunwani from Technizant presented Tuhee and Koolvite. Tuhee is an e-greeting application, with a full drag-and-drop UI. Tuhee lets the user create and send greeting cards using standard templates, clip art, text and user-uploaded images. It integrates with Flickr/Yahoo photos too. Koolvite is an e-invite application that’s built with OpenLaszlo. It uses the same drag-and-drop interface as Tuhee for creating custom invitations, so the user has more control over their appearance than they do with, say, Evite. You need to create an account in order to use Koolvite, but you can create and send cards with Tuhee just by browsing to the site.
  • Michael Hayden from genAcode demonstrated LZadmin, a database management product that uses OpenLaszlo with Ruby-on-Rails to design databases. OpenLaszlo provides the administrative interface. There’s a generally-available demo on genAcode’s web site.
  • Eugene Ciurana from LeapFrog gave an excellent presentation on why his previous employer (a very large e-commerce web site) decided on OpenLaszlo as their RIA technology of choice. Unfortunately, Eugene wasn’t allowed to disclose the name said employer, but I suspect that it’s Walmart.com, since they’re a very large e-commerce web site, who have deployed OpenLaszlo applications across their site.
  • Jon Carlo Gueco from Saven Technologies showed off an impressive set of financial charting components that he built in OpenLaszlo. The charts are loaded with features: stock-comparison overlays, draggable time-axes, plot options, zooming, etc. There isn’t a live demo, but I’ve posted a screenshot of the zooming interface below:
Charting Components

From the Laszlo side, Max Carlson demoed various runtimes of OpenLaszlo 4.0, including a peek at LZPix running inside of J2SE. This is part of Project Orbit, a Sun and Laszlo collaboration to enable OpenLaszlo applications to run on the J2ME runtime. David Temkin presented Laszlo Webtop, which I’ll write more about soon.
Stay tuned for details of the next meet up!