Dynamically adding UI elements (with event handling)
Posted: Sat Apr 02, 2011 8:23 am
Hi,
I have a stack where I want the user to be able to add objects ((e.g. images, lines, text). I can set the tool to [ ... ]. Think an "editable page". But my problem then is (let's take an image for example):
- how do I make it so that the user can add an image to the placeholder
- move the image
- resize it
Same for lines, texts, ... any ui element, really - I am trying to create a mock-up tool.
My thoughts were be that I:
a) have the user add the object to the the stack
b) dynamically attach handlers to the newly created object that implement any desired object-specific behavior (i.e. move. (reset image source, crop, ...)
How do I add the handlers dynamically (I really haven't been able to find it), and moreover, where do I store these templates in the overall stack.
I think I haven't wrapped my head around the LiveCode model to do these more dynamic things, *any* help would be greatly appreciated!!!
Thanks, Maarten
I have a stack where I want the user to be able to add objects ((e.g. images, lines, text). I can set the tool to [ ... ]. Think an "editable page". But my problem then is (let's take an image for example):
- how do I make it so that the user can add an image to the placeholder
- move the image
- resize it
Same for lines, texts, ... any ui element, really - I am trying to create a mock-up tool.
My thoughts were be that I:
a) have the user add the object to the the stack
b) dynamically attach handlers to the newly created object that implement any desired object-specific behavior (i.e. move. (reset image source, crop, ...)
How do I add the handlers dynamically (I really haven't been able to find it), and moreover, where do I store these templates in the overall stack.
I think I haven't wrapped my head around the LiveCode model to do these more dynamic things, *any* help would be greatly appreciated!!!
Thanks, Maarten