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