Sequential Layout of Script-created Objects
Bernard Devlin
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!)
on mouseUp
-- 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
"Mapping Source"
--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
end repeat
reset the templateButton
end mouseUp
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
> http://lists.runrev.com/mailman/listinfo/use-revolution
More information about the use-livecode
mailing list