PDA

View Full Version : Manipulating a view with script (not declaratively)


ange52
01-29-2007, 07:49 PM
Hello all,

I'm working on a very simple little app right now, and I'm having a hard time getting things to work out. I have a feeling that I'm trying to keep things so simple that I'm in the gray area between regular javascript, and the features LZX offers with datapaths, datapointers, etc. I feel more comfortable doing such a little thing with some plain old javascript, but the pieces aren't quite fitting together.

So my current problem goes something like this:
-I have the user type a number into a text field
-I store that number as a variable with javascript (let's call it myNum)
-Once the user moves on to the next state, I want to make a total myNum number of edittext fields on the view (to be clear: if myNum == 5, there would be 5 edittext fields showing up)

I've managed to use datapaths to let LZX magically create the proper number of checkboxes for me already, however this situation doesn't seem fit for a datapath. All I want to do is use a simple for loop with javascript to create as many edittext fields as I need and attach them to a view.

Any help to point me in the right direction would be greatly appreciated. Thanks!
Ange52

trucker_
01-30-2007, 05:44 AM
Hi, can you show me your code with datapaths for creating dynamics views and adding to a parent view please ?

I think is more difficult to do that with simple javascript because when you create a view like this: var myView = new LzView(); that view is added to the canvas and I cant find a way to add it to a different view. Or if you do that with javascript you can show the code ... ?

trucker_
01-30-2007, 06:18 AM
Hi again. I found a way to attach new view to another:
The first parameter in the constructor is the parent view :)
ex: var myView = new LzView(parent_view);
and that sentence could be in the for loop.

ange52
01-30-2007, 02:34 PM
Hey trucker, thanks for the response. I'm afraid that I'm headed in the wrong direction with all of this, though. I'm hoping to add a few text fields into a view that is already there. Could I do new edittext(parent_view) and maintain some control over it that way? Or is the proper LZX approach to turn myNum into a source of data somehow so that I can declaratively create as many edittext fields as are necessary?