Page 2 of 7
Re: Looking for Help on a Project
Posted: Thu May 25, 2017 7:41 am
by bidgeeman
Well....I actually figured this out finally myself

By setting the printer code to print to PDF instead of the printer it spits out a high quality pdf image

works great!
Sorry to have bothered you all but it's good to know you are there.
Cheers
David
Re: Looking for Help on a Project
Posted: Fri May 26, 2017 5:13 am
by bidgeeman
Hi,
EDIT: SOLVED.
I have managed to write the file to a selected folder but it does not write with the "pdf" file extension.
Added :
Code: Select all
on mouseUp
if the result is "Cancel" then exit mouseUp
set the printPaperOrientation to "portrait"
set the printMargins to 0,0,0,0
set the printPaperSize to "595,842"
ask file "Choose a file for the PDF:"
if it is not empty then
put it into SavePdf
open printing to pdf SavePdf
print this card from 0,0 to 595,842 into 0,0,900,1240
end if
close printing
end mouseUp
Thanks.
Bidge
Re: Looking for Help on a Project
Posted: Sat May 27, 2017 4:32 am
by bidgeeman
Ok...this one has me stumped. Is it a bug?
I am trying to move an image with "grab me". When I load the image I set the image locklocation to true
so it doesn't resize the image area. Works fine but when I reset the image locklocation to false the image will
not move with the grab me function.
Can anyone help with this problem please?
I am using the code below:
Code: Select all
on mouseUp
set the lockLocation of image "i1" to true
answer file "Choose a picture"
if it is not empty then
set the filename of image "i1" to it
end if
set the lockLocation of image "i1" to false
end mouseUp
Then this on the image area":
Re: Looking for Help on a Project
Posted: Sat May 27, 2017 8:08 am
by jmburnod
Hi bidge,
Grab on mouseUp doesn't work, you have to use mousedown like that:
Code: Select all
on mouseDown
grab me
end mouseDown
Best regards
Jean-Marc
Re: Looking for Help on a Project
Posted: Sat May 27, 2017 8:33 am
by bidgeeman
Oh thank you so much Jean-marc.
I am learning slowly
Bidge
Re: Looking for Help on a Project
Posted: Sat May 27, 2017 9:09 am
by jmburnod
Grab is one way to do what you want but you can't do any thing while grab
Mousemove is an other way
You may have a look at this thread
http://forums.livecode.com/viewtopic.php?f=7&t=29242
Jean-Marc
Re: Looking for Help on a Project
Posted: Sat May 27, 2017 10:06 am
by bidgeeman
Thanks Jean-marc.
I have just struck another problem I don't know how to solve or what is going wrong.
Importing an image so it stays at it's set aspect ratio but small enough to manipulate:
I have an image import button and two sliders that control the rotation and image size.
The image imports nicely and the rotation slider works fine but when I try to use the resize
slider to resize the image it loses its imported aspect ratio and pops back to the set size of
he image area which is square. How can I stop this?
Image Import code:
Code: Select all
on mouseUp
answer file "Choose a picture"
if it is not empty then
set the filename of image "i1" to it
end if
put the formattedWidth of image "i1" into nativeWdth
put the formattedHeight of image "i1" into nativeHgt
put the width of graphic "maxD" into maxWdth
put the height of graphic "maxD" into maxHgt
put constrainedDimensions(nativeWdth,nativeHgt,maxWdth,maxHgt) into newDimensions
set the width of image "i1" to item 1 of newDimensions
set the height of image "i1" to item 2 of newDimensions
set the loc of image "i1" to the loc of graphic "maxD"
end mouseUp
Rotation slider code:
Code: Select all
on scrollbarDrag pScrollValue
set the angle of image "i1" to pScrollValue
end scrollbarDrag
Image resize (the problem)
Code: Select all
on scrollbarDrag pScrollValue
set the height of image "i1" to pScrollValue
set the width of image "i1" to pScrollValue
end scrollbarDrag
Re: Looking for Help on a Project
Posted: Sat May 27, 2017 10:54 am
by jmburnod
Paul Hibbert made a stack « Angle and Resize test » you can download
Click on « sample stack » button and choose « image »
Re: Looking for Help on a Project
Posted: Sat May 27, 2017 11:03 am
by bidgeeman
Yes...I tried to implement that stack but I couldn't get it to work correctly. The temp image kept popping up full size then it would go crazy.
The code I have works well I just need to find out why the image size is changing it's aspect ratio when scaled up?
Bidge
Re: Looking for Help on a Project
Posted: Sun May 28, 2017 5:54 am
by bidgeeman
Hi again I have struck another issue I am struggling to deal with.
When I scale up my image area my text area is being thrown off center, it's actually
not scaling up perfectly with the rest of the grouped objects. Is there a way to
somehow center a text field in a group of objects?
Thanks for any help.
Bidge
Re: Looking for Help on a Project
Posted: Sun May 28, 2017 8:44 am
by SparkOut
Hi Bidge
You can of course set the loc[ation] of an object or group, and it refers to the centre point of the object. In the handler script you are using to scale and position the image you can add
Code: Select all
set the loc of field "theText" to the loc of me
where necessary you can change "me" to "the target" or other reference to the object you want to use as the centre point for the field.
Re: Looking for Help on a Project
Posted: Sun May 28, 2017 8:47 am
by bidgeeman
Hi SparkOut.
Brilliant. Thank you so much.
Unfortunately it worked but the problem cannot be fixed this way

For some reason the text is not scaling up correctly with the group.
The scaling up to pdf :
print this card from 0,0 to 595,842 into 0,0,900,1267
is causing the text to increase in size so that
words start running off and out of the text area???
I have no idea how to compensate for this???
Bidge
Re: Looking for Help on a Project
Posted: Sun May 28, 2017 8:58 pm
by SparkOut
You have fallen foul of the different screen and printing font metrics on Windows. The formatForPrinting property will need to be set to true for accurate print rendition. And false for making the screen view look acceptable. The dictionary says this has to be done while the stack is closed but I think it can be done on the fly OK.
Re: Looking for Help on a Project
Posted: Sun May 28, 2017 11:55 pm
by bidgeeman
Thank you SparkOut.
When this issue is addressed would it still work ok on a Mac?
Thanks
Bidge
Re: Looking for Help on a Project
Posted: Mon May 29, 2017 1:37 am
by SparkOut
That's something I can't say for sure. I expect it would work without change and just be ignored on a Mac. At worst it would only need a one-liner check for the platform to decide whether to set or not.