Looking for Help on a Project

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
bidgeeman
Posts: 495
Joined: Wed Feb 21, 2007 7:58 am
Location: Australia

Looking for Help on a Project

Post by bidgeeman » Fri May 19, 2017 12:16 pm

Hello.
I haven't been here since 2010 after I purchased Runrev 3.5.
Always loved the software and am a complete beginner still after all these years :)

I am wondering if anyone could assist me with a small project for our local school?
Would be happy to pay someone but can't afford a huge amount. It is basically a
small Image browser with a few libraries of images that can be imported, add some
text and printed out to A4 or A3.

I have downloaded Livecode and found a small stack online that has the basics but I
am not able to code the rest of it without help.
If anyone is interested in helping out for a few dollars please don't hesitate to contact me.

Cheers
Bidge

capellan
Posts: 654
Joined: Wed Aug 15, 2007 11:09 pm

Re: Looking for Help on a Project

Post by capellan » Sat May 20, 2017 1:48 am

Hi Bidge,

Your description seems easy enough to handle using Livecode script,
unless you want (or need) a polished interface.
(Interfaces are never completed or finished,
just perpetually improved!) :shock:

Do you actually need a polished interface and 24/7 support for this project?
Do you need a closed source application?

If not, please start asking questions and we could help you
to built this project.

Al

bidgeeman
Posts: 495
Joined: Wed Feb 21, 2007 7:58 am
Location: Australia

Re: Looking for Help on a Project

Post by bidgeeman » Sat May 20, 2017 2:07 am

Hi Al.
Thank you. I really appreciate the help. It is just a simple stand alone app
with no support or polished interface. As long as it works :)

Basically it would consist of an image area and a series of thumbnail sliders
that display the various elements. When clicked they would appear in the
image area. I am an artist so I can design all the backgrounds etc.

I'm trying to grasp the basics so please excuse.
My first question is...how do I create an A4 size image work area that is the
correct aspect ratio to A4 but smaller so you can work in it, then when it is
printed the final image comes out at high print quality? Would I be right in
assuming the backgrounds contained in the folders would all be at correct
aspect ratio high print quality, and then when they are imported into the
stack they are temporarily resized? Is resizing the image container enough
toso that anything loaded in to it will be at that dimension?
Would this be correct?

on mouseUp
set the filename of image 1 to "Background 1.png"
end mouseUp


Thanks
Bidge

bidgeeman
Posts: 495
Joined: Wed Feb 21, 2007 7:58 am
Location: Australia

Re: Looking for Help on a Project

Post by bidgeeman » Sat May 20, 2017 2:18 am

Well....I think I answered my own question. It works :)
So you can basically resize the image container and it will auto adjust
anything that is loaded into it! Now I will work on getting a load file path
script sorted. Just knowing I can ask questions here is really inspiring me.
Thanks!!!!

Bidge

EDIT: This one has me a bit stumped. Can anyone help me with the button
function on browsing and loading an image?

Thanks again
Bidge

capellan
Posts: 654
Joined: Wed Aug 15, 2007 11:09 pm

Re: Looking for Help on a Project

Post by capellan » Sat May 20, 2017 4:51 am

Download and check the scripts of this stack:
RGB_Image_to_HSV_v02

from this forum post:
http://forums.livecode.com/viewtopic.php?f=10&t=29172

In this stack, there is code to import larger images in smaller sizes.
You are free to use in your own stack, any code from this stack
that you find useful :D

Feel free to ask if you need help!

Al

bidgeeman
Posts: 495
Joined: Wed Feb 21, 2007 7:58 am
Location: Australia

Re: Looking for Help on a Project

Post by bidgeeman » Sat May 20, 2017 6:17 am

Thanks for the help capellan.
I will download and have a close look!

Bidge

bidgeeman
Posts: 495
Joined: Wed Feb 21, 2007 7:58 am
Location: Australia

Re: Looking for Help on a Project

Post by bidgeeman » Sat May 20, 2017 9:29 am

Hi.
I have got the basics going but I am having a lot of trouble now with the printing size.
My card size is 400 x 566 (A4 Aspect reatio but small enough to see the design)

I am using this button script:

Code: Select all

on mouseUp
   open printing
   set the printPaperOrientation to "portrait"
   reset printing
   set the printMargins to 0,0,0,0
   print this card
   close printing
end mouseUp 
Unfortunately this only prints about 3/4 of the page size?

Is there a way I can force the stack to print at A4?

Thanks for any help.
Bidge

EDIT:
I found this script on the forum but it does not help. The card is still printing about 3/4 of the page size :(
I'm completely stuck here.

Code: Select all

on mouseUp
   local tTargetRectangle, tTargetWidth, tTargetHeight, tSourceWidth, tSourceHeight
   local tBestFitScale, tPrintMargins
   --
   answer page setup
   if the result is "Cancel" then exit mouseUp
   -- determine the available width and height on the page
   put the printRectangle into tTargetRectangle
   put item 3 of tTargetRectangle - item 1 of tTargetRectangle into tTargetWidth
   put item 4 of tTargetRectangle - item 2 of tTargetRectangle into tTargetHeight
   put the width of this stack into tSourceWidth
   put the height of this stack into tSourceHeight
   -- determine the print scale and set it before printing
   put min(tTargetWidth / tSourceWidth, tTargetHeight / tSourceHeight) into tBestFitScale
   put min(1, tBestFitScale) into tBestFitScale
   set the printScale to tBestFitScale
   -- finally set the printMargins to fit the available print area
   put item 1 of tTargetRectangle, \
          item 2 of tTargetRectangle, \
          item 1 of tTargetRectangle, \
          item 2 of tTargetRectangle \
          into tPrintMargins
   set the printMargins to tPrintMargins
   -- go ahead and print
   open printing with dialog
   if the result is "Cancel" then exit mouseUp
   print this card
   close printing
end mouseUp

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7210
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Looking for Help on a Project

Post by jacque » Sat May 20, 2017 4:04 pm

Start with your original, short handler. Remove the reset command, that will interfere. Add the paper size to the setup before printing:

set the printPaperSize to "595,842"

See how that goes and we can take it from there.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

bidgeeman
Posts: 495
Joined: Wed Feb 21, 2007 7:58 am
Location: Australia

Re: Looking for Help on a Project

Post by bidgeeman » Sun May 21, 2017 12:45 am

Hi Jaqueline.
I used this like you said:

Code: Select all

on mouseUp
   open printing
   set the printPaperOrientation to "portrait"
   set the printMargins to 0,0,0,0
   set the printPaperSize to "595,842"
   print this card
   close printing
end mouseUp 
Thanks for that. Unfortunately it printed at the same size but this time in the middle of the page. The other times it started printing from the top Left Hand Corner.
Sorry if my replies are a bit late. I'm in Australia :)

Bidge

EDIT: Oh dear I just realized something. I am trying to print the whole card as A4 but I actually only want the Image Holder to print at A4 not the whole card as I will need to put buttons etc at the bottom and maybe some other interface objects around the card.

Is there a way to only print the Image id as A4?

Thanks again
Bidge

bidgeeman
Posts: 495
Joined: Wed Feb 21, 2007 7:58 am
Location: Australia

Re: Looking for Help on a Project

Post by bidgeeman » Sun May 21, 2017 4:54 am

I managed to get an area of the card to print to A4 with this code I hacked together :)

Code: Select all

on mouseUp
open printing
set the printPaperOrientation to "portrait"
set the printMargins to 0,0,0,0
set the printPaperSize to "595,842"
print this card from 0,0 to 595,842 into 0,0,900,1240
close printing
end mouseUp 
Just one little thing if someone could possibly advise?
I can't get the print area to completely print to the exact size of A4 borderless. There
is still a slight margin. If I add another 5 points to the 900,1240 the image starts to
dissapear off the edge of the print area. My card image area (the printable area) is 380 by 550.

(I will look for code that can set the printer to print borderless. Maybe that is the problem?)
Aha. Just checked my printer. A lot of A4 printers don't allow borderless printing so it's all
ok. Just seeing how far I could push things...LOL :)

Thanks for any help.
Bidge

bidgeeman
Posts: 495
Joined: Wed Feb 21, 2007 7:58 am
Location: Australia

Re: Looking for Help on a Project

Post by bidgeeman » Sun May 21, 2017 7:14 am

Everything seems to be going nicely but now I need some help in creating a text area where the user can set the font/size and colour so they can write in names and award titles basically a small Text Editor. Can anyone suggest a simple solution? I know a lot of text values can be controlled by code but I can only think of doing this with a load of buttons placed around the text area with preset colour buttons and buttons that control the other values. That would look quite messy :( A nice neat menu box with colour wheels, pickers and font scaling/selection is quite beyond my skill level totally.

Thanks again for any help!
Bidge

capellan
Posts: 654
Joined: Wed Aug 15, 2007 11:09 pm

Re: Looking for Help on a Project

Post by capellan » Sun May 21, 2017 10:03 pm

Check if scripts of this stack: "Text_Style_Selector.livecode" could help.
I made this stack some years ago for another request in the mail list.
Feel free to ask any question about this stack.

Al
Text_Style_Selector.PNG
Text_Style_Selector.zip
Last edited by capellan on Mon May 22, 2017 3:22 am, edited 1 time in total.

bidgeeman
Posts: 495
Joined: Wed Feb 21, 2007 7:58 am
Location: Australia

Re: Looking for Help on a Project

Post by bidgeeman » Sun May 21, 2017 11:45 pm

Hi capellan.
This looks amazing!! Thank you so much. I may need some help incorporating it but I will take a look at it and see if I can do it myself first.

Thanks so much!
Bidge

capellan
Posts: 654
Joined: Wed Aug 15, 2007 11:09 pm

Re: Looking for Help on a Project

Post by capellan » Sun May 21, 2017 11:59 pm

You are welcome! :)

Are you going to use this stack inside LiveCode IDE?
Because probably you will want to use the LiveCode IDE object inspector
to add graphic effects to the text fields.

You could produce really nice text displays using graphic effects
on text fields with their opaque property set to false.

Check this image:
Text_Style_Selector_v02.PNG
Al

bidgeeman
Posts: 495
Joined: Wed Feb 21, 2007 7:58 am
Location: Australia

Re: Looking for Help on a Project

Post by bidgeeman » Wed May 24, 2017 1:23 am

Hi again.

EDIT:
Does anyone know how I can merge this line of code:

Code: Select all

print this card from 0,0 to 595,842 into 0,0,900,1240
into the code below?

Code: Select all

on mouseUp
   put specialfolderpath("desktop") & "/snap.jpg" into tFile
   export snapshot from group "Group 1" to file tFile as jpeg 
end mouseUp

I'm trying to scale the Group in the card area to a larger size before the snapshot is exported?
I would like it to export to 900,1240. ATM am getting pixelation exporting at 400,560.
It worked for the print function and thought it might work for the snapshot as well?

The image in the rect area is already of a high quality image so scaling before snapshot should work
if this is possible?

Thanks for any help.
Bidge

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”