By doing the some proper templating on the server-side response this would give an htmlesque feel to a laszlo application; a "screen" full of "links" can invoke another screen of links. Using a fairly standard approach to how pages are generated in html-land, that is, the created links control behavior. This could break open one conceptual limitation in invoking large amount of documentation/ subviews that are relationally related to each other. Another way of saying the same thing is since the action of the <a>..</a> can be scripted server side, the "link" can instruct a the program to fetch yet another server url that populates the same or other areas in the application.

Thanks for the tip!


On Jun 4, 2007, at 7:16 PM, Maynard Demmon wrote:

Here is a little piece of laszlo code you might find usefull. It lets
you do an easy callback to your lzx app when a user clicks on a link
defined in a <text> component. Note that the syntax of
Lz.setCanvasAttribute is in the 4.x not the 3.x format of this call.

        var msg1 = "<a
href=\"javascript:Lz.setCanvasAttribute ('linkcallback','action1:value')\
">do action 1</a>";
        var msg2 = "<a
href=\"javascript:Lz.setCanvasAttribute ('linkcallback','action2:value')\
">do action 2</a>";
        myTextComponent.setText("stuff" + msg1 + "other stuff" + msg2 +
"event more stuff");

Code in main.lzx to handle the linkcallback action would look something
like this:

        <!-- ATTRIBUTES -->
        <attribute name="linkcallback"/>
        
        <!-- EVENT HANDLERS -->
        <method event="onlinkcallback" args="v">
                var index = v.indexOf(":");
                var type = v.substring(0, index);
                var value = v.substring(index + 1);
                switch (type) {
                        case "action1":
                                // do something
                                break;
                        
                        case "action2":
                                // do something
                                break;
                        
                        // More cases for additional actions as needed
                }
        </method>
                        
Maynard Demmon - [EMAIL PROTECTED]
Senior Developer - Laszlo Systems



Reply via email to