Hello Folks,
Been playing around with LiveCode a lot recently, and I've been working on a goofy GUI game about managing a mine. I recently reached a stumbling block and I thought I'd ask here as I didn't find answers readily through google.
Basically, I want to script a button that will create a group of objects eg. a datagrid with specific Properties, a Progress bar (with properties) below it and a couple buttons(with scripts and properties). What I am hoping is that there is some way to create it first by hand using the tools menu so that I can easily tweak it to look the way I want, and then save the whole thing as some kind of 'template' so that a handler could be used to create a new group with those specific objects and properties later. For example, Is it possible to have livecode spit out all the nitty-gritty properties etc. of an existing object (or group) as a script that I could copy and paste into the script of another button?
Is anything like this possible? Or do I need to script every Property and location of every object line by line?
Any help is appreciated!
Shortcut to creating groups of Objects?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Re: Shortcut to creating groups of Objects?
Hi.
You can set the properties of the templateGroup to an existing group, but that will not create as well the controls contained in the master.
Would the "clone" command help?
Craig Newman
You can set the properties of the templateGroup to an existing group, but that will not create as well the controls contained in the master.
Would the "clone" command help?
Craig Newman
Re: Shortcut to creating groups of Objects?
Hello again, I think you helped me out with my first post on these boards a few weeks back.
For a bit more explanation of what I've got in mind
on a card there are three Option Menus. each menu has a few items that have some "stats" that are associated with them.
Within an Option Menu, the stats are formatted the same for each option (with only numbers changing). It would be easy to have the numbers change withing an existing group.
However, the other option menus also have a few items each, but their "stats" are totally different and in a different format.
I wanted the "stats" of whatever the last selection was to be displayed in the same part of the card.
The clone command could work, I think.... would it require me to create a blank version of each group and then set the whole thing to invisible so that its there to clone? I suppose that sounds doable.
Is there a way to have LiveCode generate a text version of all of an existing objects properties? Does this make sense?
For a bit more explanation of what I've got in mind
on a card there are three Option Menus. each menu has a few items that have some "stats" that are associated with them.
Within an Option Menu, the stats are formatted the same for each option (with only numbers changing). It would be easy to have the numbers change withing an existing group.
However, the other option menus also have a few items each, but their "stats" are totally different and in a different format.
I wanted the "stats" of whatever the last selection was to be displayed in the same part of the card.
The clone command could work, I think.... would it require me to create a blank version of each group and then set the whole thing to invisible so that its there to clone? I suppose that sounds doable.
Is there a way to have LiveCode generate a text version of all of an existing objects properties? Does this make sense?
Re: Shortcut to creating groups of Objects?
Play with "the properties" er, property. Note that this is naturally an array, so you will want to deconstruct it with the "combine" command to read the data easily.
Craig
Craig
Re: Shortcut to creating groups of Objects?
Create the controls you want to reuse. Eg a field:
Set the cTemplateFieldProps of this card to the properties of field "myTemplateField"
Remove the "template" object. (Not "the template object")
When you want to recreate an object you can then set its properties from the saved custom property.
" the properties " contains most of the properties you would find useful. It may not be a complete list of everything
Set the cTemplateFieldProps of this card to the properties of field "myTemplateField"
Remove the "template" object. (Not "the template object")
When you want to recreate an object you can then set its properties from the saved custom property.
" the properties " contains most of the properties you would find useful. It may not be a complete list of everything