[SOLVED] Creating UI in runtime

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
merowech
Posts: 2
Joined: Tue Oct 04, 2011 9:13 am

[SOLVED] Creating UI in runtime

Post by merowech » Tue Oct 04, 2011 9:44 am

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
Last edited by merowech on Tue Oct 04, 2011 12:44 pm, edited 1 time in total.

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

Re: Creating UI in runtime

Post by Dixie » Tue Oct 04, 2011 12:19 pm

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
Attachments
createControls.livecode.zip
(1.63 KiB) Downloaded 166 times

merowech
Posts: 2
Joined: Tue Oct 04, 2011 9:13 am

Re: Creating UI in runtime

Post by merowech » Tue Oct 04, 2011 12:43 pm

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

Post Reply