Page 1 of 1

[SOLVED] Creating UI in runtime

Posted: Tue Oct 04, 2011 9:44 am
by merowech
Hi all,

I am new to LiveCode, however, not new to programming (C#, microcontroller, webdevelopment...) but the need has arisen to create a tool which can be used on Mac OS X.
A colleague showed me LiveCode and I quite like it so I chose it for this task.


What I want to do:
In the main stack I have a text input field in which a number is entered. After pressing a button a set of controls (1 label, 2 input fields) should be added to the main stack multiplied by the number in the input field (e.g. "6" will result in 6 of these control sets added to the UI).

My questions:
1) Can I model the set of controls first and then use a command to add various instances of this control set to the main stack?
2) Would it be easier just to create a new stack with createStack as this part of the UI will always be created new and doesn't have to be saved? Are there any drawbacks in this method?

I have done research on creating the UI on the runtime but I couldn't find useful stuff. Maybe I used the wrong terminology or I'm completely on the wrong way of tackling the problem, please let me know.

Thanks in advance for help & advices,
Mero

Re: Creating UI in runtime

Posted: Tue Oct 04, 2011 12:19 pm
by Dixie
Mero,

I have attached a stack that will 'basically' do what you require... the handlers are in the script of the button 'create controls'

be well

Dixie

Re: Creating UI in runtime

Posted: Tue Oct 04, 2011 12:43 pm
by merowech
Hi Dixie,

thank you very much for your solution which works perfect.
I just had time for a quick look into your stack but the whole principle seems pretty simple once you got there.

My next step will be to implement this into my stack and add the functionality needed.


Cheers,
Mero