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
Dynamically adding UI elements (with event handling)
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- VIP Livecode Opensource Backer
- Posts: 20
- Joined: Sun Dec 28, 2008 3:26 pm
Re: Dynamically adding UI elements (with event handling)
Hi Maarten...
Have a look at the stack that I have attached... It shows you how to create the properties of an image, put a handler into the script of the image and then create it, I think that the script will be fairly self-explanatory. this example doesn't cover everything you asked about, but should get you started in the right direction...
Have a look at templateImage and create in the dictionary...
hope it helps,
Dixie
Have a look at the stack that I have attached... It shows you how to create the properties of an image, put a handler into the script of the image and then create it, I think that the script will be fairly self-explanatory. this example doesn't cover everything you asked about, but should get you started in the right direction...
Have a look at templateImage and create in the dictionary...
hope it helps,
Dixie
- Attachments
-
- Add Things.zip
- (1.35 KiB) Downloaded 262 times