No, I think you're probably doing things right. We're facing the same
thing. Laszlo allows you to throw together apps that *look* fantastic very
quickly and with very little code. However, making them actually do useful
things is quite difficult. I suspect that this is purely a maturity thing.
Laszlo just hasn't been around long enough. Look at how long it took Java
to get to the point where you could develop a desktop app in it. It took so
long that most people gave up and resigned java to web server applications
using Servlets and JSP (i.e. no Swing).
Wait until you try to validate user input in laszlo. For example, we have
several sets of chained comboboxes in our app. If the user selects
something in the first combo, the list of choices changes in the second box.
Making something seemingly as simple as this is far more difficult than it
should be because the combobox isn't completely finished yet. A major
omission is a method to get the number of items. Another is a method to
"setItems" that takes a list of items. You end up resorting to extending
combobox and adding methods...
<method name="setItems" args="list">
var currentCount = this.cblist.getNumItems();
for (var i = 0; i < currentCount; i++) {
this.removeItemAt(0);
}
for(var i=0; i<list.length; i++) {
this.addItem(list[i], i);
}
</method>
Another validation area that is a problem is control over input in textboxes
at the character level. We really need to intercept and validate character
input *before* it gets inserted into the textbox.
Finally, our app has a tabbed layout. If a user enters invalid data in a
textbox, then clicks one of the other tabs, we need to prevent the tab
switch from occuring. Currently, this seems impossible. I made some
suggestions regarding a shouldYieldFocus() method that may help things but
I'm not positive that it will work with tabs.
I have no doubt that the problems will eventually be ironed out but it's
really a matter of timing. If it doesn't happen fast enough, people like us
will give up on it and try "the next big thing". I've got my fingers
crossed though. :)
-----Original Message-----
From: James Howe [mailto:[EMAIL PROTECTED]
Sent: Friday, January 13, 2006 2:18 PM
To: William Krick; [email protected]
Subject: Re: [Laszlo-user] Obtaining the index of an item in a list
Thanks for the tip. I think I can probably do something like you describe.
One of things I'm finding frustrating with Laszlo is that there are many
things which should be simple to do, but in Laszlo they aren't. If 'list'
is going to offer a selectAt(index) method, it would seem there should be
an easy way to get the currently selected item index. I seem to be
running into this a lot lately. Perhaps it just means I'm not doing
things the 'right' way.
Thanks again for your help.
On Fri, 13 Jan 2006 12:24:37 -0500, William Krick <[EMAIL PROTECTED]>
wrote:
> This probably isn't exactly what you want but it might serve as the basis
> for a workaround...
>
> When you build a list item, you can set a "value" and make it the index.
>
> Here's some code off the top of my head. It won't compile or anything
> but
> it will give you an idea what I mean...
>
> Here's some data...
>
> <resultset>
> <result id="0" year="1989"/>
> <result id="1" year="1990"/>
> <result id="2" year="1991"/>
> <result id="3" year="1992"/>
> <result id="4" year="1993"/>
> <result id="5" year="1994"/>
> <result id="6" year="1995"/>
> <result id="7" year="1996"/>
> <result id="8" year="1997"/>
> <result id="9" year="1998"/>
> <result id="10" year="1999"/>
> <result id="11" year="2000"/>
> <result id="12" year="2001"/>
> <result id="13" year="2002"/>
> <result id="14" year="2003"/>
> <result id="15" year="2004"/>
> <result id="16" year="2005"/>
> <result id="17" year="2006"/>
> </resultset>
>
>
> here's a combo box (I left out the datapath stuff)...
>
> <combobox name="cb1" editable="false">
> <textlistitem text="$path{'@year'}" value="$path{'@id'}" />
> </combobox>
>
>
> Then you can say something like...
>
> var index = cb1.getValue();
>
>
> -----Original Message-----
> From: James Howe [mailto:[EMAIL PROTECTED]
> Sent: Friday, January 13, 2006 11:59 AM
> To: [email protected]
> Subject: [Laszlo-user] Obtaining the index of an item in a list
>
>
> I have a list which is constructed from XML. When a user makes a
> selection I want to remember so I can use a selectItemAt call at some
> point in the future. As far as I can tell, there is no way to get the
> index of a selected item in a list. Am I overlooking something?
>
> Thanks!
>
> --
> James Howe
> _______________________________________________
> Laszlo-user mailing list
> [email protected]
> http://www.openlaszlo.org/mailman/listinfo/laszlo-user
>
>
--
James Howe
_______________________________________________
Laszlo-user mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-user