Aligning the edge of an image
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Aligning the edge of an image
Hi.
I'm a bit stuck with how to go about this one. LC Images seem to be resized from the center of origin, so I need to be able to resize a business card sized image but still have it's left edge stay at the same location. Can anyone suggest a way to do this?
I can't get "set the left loc of image "Card" to 20,20" to work?
Thanks
Bidge
I'm a bit stuck with how to go about this one. LC Images seem to be resized from the center of origin, so I need to be able to resize a business card sized image but still have it's left edge stay at the same location. Can anyone suggest a way to do this?
I can't get "set the left loc of image "Card" to 20,20" to work?
Thanks
Bidge
Re: Aligning the edge of an image
SOLVED: set the topleft of image "Card" to 14,14
Thanks
Bidge
Thanks
Bidge
-
- Livecode Opensource Backer
- Posts: 9388
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Aligning the edge of an image
You don't need to use 'topleft': keep things simple . . . .
Re: Aligning the edge of an image
Oh....thank you richmond62. I did not realize you could only use one value
Thanks again
Bidge
Thanks again
Bidge
Re: Aligning the edge of an image
It gets harder now ......I have a gap between the two images I would like to stay the same. How can I keep these images side by side and maintain the gap if the images are resizable?
Bidge
Bidge
-
- VIP Livecode Opensource Backer
- Posts: 2718
- Joined: Sat Dec 22, 2007 5:35 pm
- Location: Genève
- Contact:
Re: Aligning the edge of an image
Hi Bidge,
You can play with location as you want.
In your case probabily something like that
Best regards
Jean-Marc
You can play with location as you want.
In your case probabily something like that
Code: Select all
put the topright of img 1 into tTR
put 24 into tMargin
add tMargin to item 1 of tTR
set the topleft of img 2 to tTR
Jean-Marc
https://alternatic.ch
Re: Aligning the edge of an image
Hi Jean -Marc.
EDIT: Ahhh...I got it. I put the script into the card and it worked! Is there a way to do this with a group of two or more objects?
Thank you Jean-Marc
Thank you again. I put your script directly into a drag gable group of two images "W" and "E" and nothing happened?
Tried adjusting the margin numeric value but nothing. I probably am in error
Cheers
Bidge
EDIT: Ahhh...I got it. I put the script into the card and it worked! Is there a way to do this with a group of two or more objects?
Thank you Jean-Marc
Thank you again. I put your script directly into a drag gable group of two images "W" and "E" and nothing happened?
Tried adjusting the margin numeric value but nothing. I probably am in error
Code: Select all
on mouseDown
grab me
put the topright of img "W" into tTR
put 84 into tMargin
add tMargin to item 1 of tTR
set the topleft of img "E" to tTR
end mouseDown
Bidge
Re: Aligning the edge of an image
Hi.
This works great. I can't stop playing with the "Side" margins value but i don't know how to set a horizontal margin for the bottom so a 3rd image can be placed with a similar margin that can be altered?
Many thanks
Bidge
This works great. I can't stop playing with the "Side" margins value but i don't know how to set a horizontal margin for the bottom so a 3rd image can be placed with a similar margin that can be altered?
Many thanks
Bidge
-
- VIP Livecode Opensource Backer
- Posts: 2718
- Joined: Sat Dec 22, 2007 5:35 pm
- Location: Genève
- Contact:
Re: Aligning the edge of an image
Hi
I quickly made a stack with two imgs in a locked group using
grab and mousemove.
If your group is not locked you have to consider that group is resized automaticaly
Here is the script group
I quickly made a stack with two imgs in a locked group using
grab and mousemove.
If your group is not locked you have to consider that group is resized automaticaly
Here is the script group
Code: Select all
local sMyImg,sOtherImg,sMargin
on mouseDown
put the short name of the target into sMyImg
if sMyImg = "W" then
put "E" into sOtherImg
else
put "W" into sOtherImg
end if
put 84 into sMargin
grab the target
end mouseDown
on mousemove
doMoveOther
end mousemove
on doMoveOther
if sMyImg = empty then exit doMoveOther
if sMyImg = "W" then
put the topright of img "W" into tTR
add sMargin to item 1 of tTR
set the topleft of img sOtherImg to tTR
else
put the topleft of img "E" into tTL
subtract sMargin from item 1 of tTL
set the topright of img sOtherImg to tTL
end if
end doMoveOther
- Attachments
-
- stMoveTogetherInGrp001.zip
- (4.98 KiB) Downloaded 185 times
https://alternatic.ch
Re: Aligning the edge of an image
Thanks so much for that Jean -Marc.
It is wonderful learning what can be done with Livecode
I managed to get three images aligned, the first two alisgned side by side with a margin as per your first example.
The 3rd image is sitting beneath the 1st image which is perfect but I need to
understand how to be able to insert a margin at the bottom so that there is a space that can be adjusted all around the images?
My code based on yours.
Many thanks again
Bidge
It is wonderful learning what can be done with Livecode
I managed to get three images aligned, the first two alisgned side by side with a margin as per your first example.
The 3rd image is sitting beneath the 1st image which is perfect but I need to
understand how to be able to insert a margin at the bottom so that there is a space that can be adjusted all around the images?
My code based on yours.
Code: Select all
on mouseDown
put the topright of image "W1" into tTR
put the bottomright of image "W1" into tTR2
put 34 into tMargin
add tMargin to item 1 of tTR
set the topleft of img "W2" to tTR
set the topright of img "W3" to tTR2
end mouseDown
Many thanks again
Bidge
-
- VIP Livecode Opensource Backer
- Posts: 2718
- Joined: Sat Dec 22, 2007 5:35 pm
- Location: Genève
- Contact:
Re: Aligning the edge of an image
Hi,
You may try this (no tested)
You may try this (no tested)
Code: Select all
...
add 34 to item 2 of tTR2
set the topright of img "W3" to tTR2
...
https://alternatic.ch
Re: Aligning the edge of an image
Wow...Thank you again Jean -Marc
I will study it to try and understand what's going on.
Many thanks for your help!
Bidge
I will study it to try and understand what's going on.
Many thanks for your help!
Bidge
-
- Livecode Opensource Backer
- Posts: 9388
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Aligning the edge of an image
Sometimes I get a feeling that people tend to over-complicate things . . .
https://www.dropbox.com/s/7v28xc2vcq6xh ... e.zip?dl=0
https://www.dropbox.com/s/7v28xc2vcq6xh ... e.zip?dl=0
-
- VIP Livecode Opensource Backer
- Posts: 2718
- Joined: Sat Dec 22, 2007 5:35 pm
- Location: Genève
- Contact:
Re: Aligning the edge of an image
Hi Richmond,
I see each time I used a "simple way" in a large stack I need to rewrite it using params, functions, variables and customprop. I win a lot of lines and develop my capacities to think globaly a project.
Further, updates are easier
Best regards
Jean-Marc
As each time we search a flexible way. Flexibility often needs complexity...Sometimes I get a feeling that people tend to over-complicate things . . .
I see each time I used a "simple way" in a large stack I need to rewrite it using params, functions, variables and customprop. I win a lot of lines and develop my capacities to think globaly a project.
Further, updates are easier
Best regards
Jean-Marc
https://alternatic.ch
-
- Livecode Opensource Backer
- Posts: 9388
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Aligning the edge of an image
C'est possible, mais Je cherche chaque chance pour une méthode trop simple,Flexibility often needs complexity...
mais Je suis paresseux