Chapter 17, section 3 of the Software Engineer's Guide to Developing
OpenLaszlo Applications seems to have what you're looking for.
Martin Allchin wrote:
> Okay sorry folks, I've solved this one.
>
> There should be a page that has the demo code on how to do this :-)
>
> I did:
>
> <view name="tabImage1" x="9" y="2" datapath="image1"
> resource="$path{'text()'}" width="30" height="30" />
>
> Martin Allchin wrote:
>
>> Hi,
>>
>> I've posted various questions before to the forums/mailing list but
>> never had much of a response, there's only one guy who kindly answered
>> many of the posts, although I am still in some confusion.
>>
>> Is there an irc to ask stuff? Sometimes you need a simple one on one to
>> get your head around how something works.
>>
>> Well, here goes anyway... The question:
>>
>> I'm manipulating the Laszlo dashboard demo and editing the contactslib
>> class. It seems the class is passed a dataset, and it loops through it
>> to render some tabs.
>>
>> I don't really see how the class knows to loop over the dataset, other
>> languages have simple loops, I can't see any in the class at all.
>>
>> The problem I've having is trying to get an image to display on the tab.
>> The text elements use a datapath to reference a value of the current
>> data in the dataset like so:
>>
>> [code]<text name="tabName" fontsize="10" fgcolor="0x222222" x="150"
>> y="2" datapath="name/text()" font="vera" width="180" />[/code]
>>
>> How can I change this to show an image instead? I'm doing something like
>> this but it doesn't work:
>>
>> [code]<view name="tabImage1" x="9" y="2" datapath="image1/text()"
>> width="30" height="30">
>> <method event="oninit">
>> var imgSrc = this.datapath.xpathQuery();
>> tabImage1.setSource(imgSrc);
>> </method>
>> </view>[/code]
>>
>> Is there an easy way to simple set the resource of a view to use a url
>> defined in the dataset, much as the text works. It seems logical to me
>> you should be able to do resource=image1/text()", or maybe
>> datapath="image1/text()", but niether of these works. I had to do a
>> kinda bodge on some other code to get at the url by using xpathQuery,
>> but doesn't seem to work so well here.
>>
>> Is there a guide to how this all works? I've read much of the
>> documentation but it doesn't go into much detail regarding looping
>> datasets. I haven't found any definitive this-is-how-it-works with
>> step-by-step examples which would really help explain things much better.
>>
>> _______________________________________________
>> Laszlo-user mailing list
>> [email protected]
>> http://www.openlaszlo.org/mailman/listinfo/laszlo-user
>>
>>
>>
>
>
> _______________________________________________
> Laszlo-user mailing list
> [email protected]
> http://www.openlaszlo.org/mailman/listinfo/laszlo-user
>
>
_______________________________________________
Laszlo-user mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-user