I need help getting my Livecode program to do what I need it to. - livecode

I have created some buttons and some graphics on a substack for referencing. I need to be able to click on button to call an instance of one of those graphics onto the main stack. Then I want to be able to drag that graphic onto one of my other buttons and have it replaced with a different graphic. I would love any help with the coding or a link to a tutorial on how to do something similar. For example my basic button is a cups button. When its clicked I want it to create an instance of my "EmptyCup" graphic. But then if I drag the EmptyCup graphic to the CoffeeMachine button I want to replace EmptyCup with CupOCoffee and so on.

To put a copy of the graphic in another stack, use the copy command, like this:
copy graphic "EmptyCup" of stack "Resources" to stack "Main Screen"
There are a number of ways to change the graphic when you drag it, but the simplest way is to set the properties you want to change:
on mouseEnter -- goes in the "CoffeeMachine" button script
set the style of graphic "EmptyCup" to \
the style of graphic "CupOCoffee" of stack "Resources"
-- you can set other properties as well, such as the backColor, etc.
end mouseEnter
If you're using images rather than graphics, set the imageData property instead (after making sure the image's size is the same as the one whose imageData you want to use):
set the width of image "EmptyCup" to ]
the width of image "CupOCoffee" of stack "Resources"
set the height of image "EmptyCup" to ]
the height of image "CupOCoffee" of stack "Resources"
set the imageData of image "EmptyCup" to ]
the imageData of image "CupOCoffee" of stack "Resources"

Related

Create dynamic static grid layer for editable gridstack grid

I am trying to create dashboard edit mode grid with gridstack javscript library.
Here is what I am trying to accomplish which is similar to this Databox platform. This is what it looks like when you edit any of the dashboard to view/edit it in grid mode.
So when I drag the blue border handle and scale the div(or even move with cursor hand) then the around grid(which is background layer with absolute position in reality) is automatically adjusted to match the corresponding div. Like this.
Even if there are multiple widgets there, resizing is working everything perfectly fine.
e.g. if there was any sibling widget then resizing this widget would also resize the sibling widget but can not go beyong 1 * 1 grid which is smallest size there.
Even after resizing both widgets, the background static grid boxes (with yellow border) fills the remaining vacant space similar to what is the concept of dense packing algorithm in css grid.
They are removed when widget is grown and added when it is shrinked.
As it seems super complicated to achieve this, is there any default feature like this with grid-stack library?

Is there a way to put a background inside SVG

I need to make an SVG that is to be used as a background-image with "cover", so the tile in the mosaic could be rescaled.
I'd like to have the icon at a fixed size and the posibility to always fill with a background color, because, to make matters more complicated, my image is going to be inside a container that is inside the tile
this is my example
my icon should go inside that red outlined box, fixed size and the background in gray
could i get that done?

Changing only some path/group fills in a background image using svg-sprites

I'm using svg as a background image (logo) in a WP menu plugin and i want it to change a color (fill) when hovered. As it's a free version of the plugin i can't use image, object etc - i have to use my svg as a background image. I've to support IE (9+) so masks/filters are out of question and i'm pretty much left with svg-sprites. That's okey, i know how to do it (using use/xlink:href).
But now comes a tricky part. I want my svg to change only fills of some groups/paths while hovered leaving others untouched. I can only change colors of all paths/groups together in a background image with svg-sprites afaik. Is there a way to do it? Thank you in advance!

How to fade a part of an object or image in corona sdk when move it?

I have a question in corona sdk. I need to fade top part of an object (like 60px of 250px) when moving the object to top before it goes out of the screen.
In another word, I need to set a display area for an image or object which its height is more than screen height. Like a top padding space which image will be faded when moving out of the display area (not the screen area)
Any tutorial or suggestion?
Sounds like image masks are exactly what you need.
In your case you would need to set the mask when moving the object to top, unset it when it comes back.
You can check the documentation for masks here:
http://docs.coronalabs.com/guide/media/imageMask/index.html

Zoom into picture

I have this picture which I want to display into JavaFX application.
I tested to use setFitHeight and setFitWidth but the image is shrink. I want to zoom the original picture and display only the center of the image keeping the original size. Is this possible?
Define a viewport in an ImageView.

Resources