Sequential Layout of Script-created Objects
revolution at knowledgeworks.plus.com
Sat Dec 7 08:04:01 EST 2002
I've managed to get this dynamic layout working (though it may not be the most
efficient way to do it!)
-- set style and location of new buttons
set the threeD of the templateButton to false
set the height of the templateButton to 26
set the width of the templateButton to the width of graphic
"grfButtonsBorder" of group "grpButtons" of stack "Map"
set the left of the templateButton to the left of graphic "grfButtonsBorder"
of group "grpButtons" of stack "Map"
set the top of the templateButton to the top of graphic "grfButtonsBorder" of
group "grpButtons" of stack "Map"
set the tooltip of the templateButton to "click here to place this text at
the insertion point"
repeat for each line currentLine in field "fdPaletteButtonSource" of stack
--create buttons from text field
create button currentLine in group "grpButtons" of stack "Map"
set the label of it to currentLine
put the bottom of it into lastButtonBottom
set the top of the templateButton to lastButtonBottom
reset the templateButton
I have a couple of questions:
1) do created buttons have to be placed in a group? (The Transcript
documentation seems to say so, and playing around with permutations of the
examples didn't work).
2) the above code lays any new buttons on top of the old buttons when the code
is run again. I am sure I can get hold of the contents of the group
"grpButtons" in order to delete each old button, but I don't know how.
> I am generating a palette of buttons based on the items in a text field (one
> button per item).
> The text is in one stack, and the palette is a separate stack. I can generate
> the buttons (and set properties of them by setting the templateButton).
> However, all the buttons are generated in the palette at the same location.
> How can I generate them so that they are laid out sequentially:
> a) in one long line
> b) in a table format (dynamically re-laid if the palette is re-sized).
> use-revolution mailing list
> use-revolution at lists.runrev.com
More information about the Use-livecode