Adding Controls at 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
pungggi
Posts: 2
Joined: Fri Jun 21, 2013 4:19 pm

Adding Controls at Runtime

Post by pungggi » Fri Jun 21, 2013 4:21 pm

Hello im evaluating runrev.

so, before looking to deep, im wonder if it is possibile
to write code for adding controls at runtime?

best regards

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Adding Controls at Runtime

Post by Klaus » Fri Jun 21, 2013 4:43 pm

Hi pungggi,

sure you can!
Check "create" and "templateXXX" in the dictionary, where XXX stands for button, field or any other LC control.

Example to create a field with font ARIAL, fontsize 14, at the topleft of the current card, 300 pixel wide, 400 pixel high:
...
set the textfont of the templateFIELD to "Arial"
set the textsize of the templateFIELD to 14
set the rect of the templatefield to 0,0,300,400
## Set whatever properties your new field should have...

## Now create a field with the above set props
create field
...

Best

Klaus

pungggi
Posts: 2
Joined: Fri Jun 21, 2013 4:19 pm

Re: Adding Controls at Runtime

Post by pungggi » Fri Jun 21, 2013 4:57 pm

Hi Klaus, danke for the quick answer..

and this way i could theratically build the entire layout of the app?

Exactly what I was looking for!
Last edited by pungggi on Fri Jun 21, 2013 5:27 pm, edited 1 time in total.

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Adding Controls at Runtime

Post by Klaus » Fri Jun 21, 2013 5:22 pm

Hi pungggi,

yes, that is possible! :-)

But remember that standalones have a "scriptlimit"!
Check "scriptlimits" in the dictionary for more info!


Best

Klaus

Post Reply