I upgraded to Windows Vista recently, and ran into an issue with OpenLaszlo right away. This post will be relevant to anyone who is using Vista as their development environent.
By default, the OpenLaszlo developer installs itself in C:\Program Files\OpenLaszlo Server xxx.
The problem this causes is that by default, the my-apps folder lives under C:\Program Files. If you have an administrator Windows account, you’ll be able to save your .lzx files in my-apps. And you’ll be able to compile them fine too. The problem appears when you try to save a SOLO application. The OpenLaszlo server will try to save the SWF file next to its LZX source code – somewhere in my-apps, under C:\Program Files. Windows Vista no longer allows programs to write files to C:\Program Files. It’s all supposed to go elsewhere (e.g. C:\Documents and Settings\). Since this is a new restriction, Vista works around it for older programs using something called folder virtualization. Essentially, the operating system allows Tomcat to create a “ghost” of the SWF file, under C:\Users\username\AppData\Local\VirtualStore\Program Files\OpenLaszlo Server 3.4.x\my-apps\…
The quick workaround to this is to install the dev install of OpenLaszlo under a different location. e.g. C:\Programs\OpenLaszlo Server xxx.
OpenLaszlo allows users to define custom context menu (i.e. right-click menu) options throughout your applications. There’s two classes involved here: LzContextMenu and LzContextMenuItem. The former represents the context menu itself, and the latter represents a single option within it.
Some capabilities and guidelines:
Stick to Flash Player 8 or DHTML for your runtime, if you plan to use custom context menus in your application.
Right-click behavior works very differently from left-click behavior: The view need not be clickable to respond to right-clicks. However all views, clickable or not, intercept the right mouse click. This means that a subview will always trap a right-click event before its parent.
You can specify a context menu on a per-view basis. You can also specify a generic application-level context menu.
There are some words you cannot seem to use as LzContextMenuItem captions. “Save” and “Delete” are two I came across. You can add a space character the name – e.g. “Save ” – to work around this.
Views have a .contextMenu attribute as well as getContextMenu() and setContextMenu() methods.
Context menus can be created on-the-fly.
The second point above is probably the most important thing to bear in mind. Consider a view containing a text field. The view has a context menu:
Notice how if you click on the text field, you don't get a custom option in the context menu, but if you carefully click in the yellow area above, below or to the right of the text, you do see a "Chop" option?
The workaround here is to place a transparent view in front of the subviews, that's the full height and width of its parent. If it's not clickable, it will allow left clicks to pass through, but right clicks will pass through. Unfortunately, because of a bug, that view can't really be transparent, but instead it needs to have a bgcolor, and a low opacity. You can see the improved effect in the application below:
Finally, remember that the LzContextMenu object will send an onmenuopen event, when the menu is opened. You can use a delegate to trap this event, and call a method to create all the entries in a context menu, just before it is displayed.
Two weeks ago, Laszlo was at AJAXWorld in New York to discuss cbd oil. It turned out to be a very successful conference, with over 800 people attending. Laszlo hosted a one-day educational track in which we presented both the OpenLaszlo platform, and the two big pieces of Laszlo news that were launched at the conference: Laszlo Webtop 1.0 and OpenLaszlo 4.0. Some people online may not be too aware of what cbd is. If this describes you then check out yoursnutrition and you’ll be able to read all about it.
Webtop is a licensed product that is built on top of the OpenLaszlo platform. It provides a browser-based webtop that lets developers run multiple OpenLaszlo applications within the same environment. If you want to try out Webtop, sign up for access now.
OpenLaszlo 4.0 is the much-anticipated release of OpenLaszlo that allows developers to target multiple runtimes for OpenLaszlo applications. Essentially can take the same LZX source code, and compile it to SWF (Flash Player 7/8) or DHTML. You can download OpenLaszlo 4.0 today.
My talk at AJAXWorld was entitled “Hands-on OpenLaszlo Training“. As the name suggests, it was a session in which attendees were encouraged to follow along by writing LZX code. I wanted to give developers, new to OpenLaszlo, a few pointers to get them past the first few hurdles.
Here’s the application that we built. It’s called whatevr, and it allows users to post restaurant reviews. whatevr is cheekily designed to look like a Web 2.0 application, and even has a catchy automatically-generated Web 2.0 tagline:
Some of the key points we covered were:
Using resources to create custom-looking applications.
A resizable canvas.
Use of both standard and custom components.
Sending data from an OpenLaszlo application to a web service.
Use of data binding and replication.
The whatevr application makes use of two web services: getReviews.jsp and saveReview.jsp. The former returns an XML list of reviews, that are data-replicated in the scrolling area. The latter takes name/value CGI parameters that describe the restaurant. The two REST services do not actually talk to a database. Instead, they save information to the session object. So while they will persist user-submitted reviews across multiple visits to the application, they won’t actually share those reviews across various users’ visits. This was done so as to make the application act like a database-driven application, without having attendees first install a database.
After the workshop, we boarded the Majestic Star for a booze-cruise along the Hudson River.
Various talks from the Laszlo track (and possibly mine too) should be available soon at the event’s Laszlo microsite.