Page 1 of 1
Creating Elements Dynamically
Posted: Sun Nov 15, 2009 11:44 pm
by bidgeeman
Hello.
Rev tutorials show me how to drag and drop elemts into a stack....but say I need to create several hundred elements in RR like checkboxes. This would need to be done dynamically as the Rev interface cannot handle so many physical elements in the interface at once. It completely slows down my machine.
So my question is:
How can you create checkboxes dynamically in Rev?
Is it possible?
Cheers
Bidge
Posted: Sun Nov 15, 2009 11:59 pm
by malte
hi bidge
well possible
set the style of the templateButton to "checkbox"
repeat with i=1 to 100
create button ("checkbox"&&i)
set the loc of it to random(100),random(110)
-- you get the idea
end repeat
Posted: Mon Nov 16, 2009 12:02 am
by bidgeeman
ahh...thanks malte!!!
I am a video tutorial novice learning very slowly
Cheers
Bidge
Posted: Mon Nov 16, 2009 12:46 am
by bn
Bidge
try this script, some of the options are just to show that you can code a lot of things into these checkboxes,
Code: Select all
on mouseUp
reset the templatebutton
set the style of the templatebutton to "checkbox"
set the hiliteborder of the templatebutton to false
set the tooltip of the templatebutton to "click me to make a change" -- optional
-- you can set a lot more of the properties of the templatebutton here
put the colornames into tColors
put "on mouseUp" & cr & "answer the short name of me" & cr & "end mouseUp" into tScript
put 50 into tButtonLeft -- start left position
put 50 into tButtonTop -- start top position
put 1 into tCounter
put 3 into tCollums -- adjust for No of Collums
put 3 into tRows -- adjust for No of Rows
lock screen
repeat with i= 1 to tCollums
repeat with j = 1 to tRows
create button
set the name of the last button to "myButton" & tCounter -- optional
set the label of the last button to "Label of btn " & tCounter -- optional
set the script of the last button to tScript -- optional
set the foregroundcolor of the last button to any line of tColors -- optional and not advised
set the top of the last button to tButtonTop
add the height of the last button + 4 to tButtonTop -- adjust
set the left of the last button to tButtonLeft
add 1 to tCounter
end repeat
put 50 into tButtonTop
add the width of the last button + 4 to tButtonLeft -- adjust
end repeat
end mouseUp
regards
Bernd
Posted: Mon Nov 16, 2009 12:55 am
by bidgeeman
WOW
Thanks for thet Bernd!!!!
These are the types of examples I cannot seem to find anywhere.
I thank you muchly

Bidge
Posted: Mon Nov 16, 2009 2:44 am
by Regulae
Bernd,
That's a classic script, definitely one for the scrapbook!
Regards to fellow Rev-olutionaries.
Posted: Mon Nov 16, 2009 10:46 am
by Janschenkel
Be aware that there are 'scriptLimits' that come into play when running a standalone. If you want to add scripts to these dynamic controls, they can be no longer than 10 lines; so if they need to be longer, you should delve into the message path, and more specifically behaviors, frontscripts and backscripts.
A good read on this topic is Richard Gaskin's article
Extending the Runtime Revolution Message Path, which explains this in great detail and clarity.
HTH,
Jan Schenkel.