Working in Inches

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

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

Working in Inches

Post by bidgeeman » Sat Jul 15, 2017 2:43 am

Hi.
I can't find anything on the forum relating to this question.

How would you go about making an image area that can be resized by
allowing a user to write in inches and fractions of inches into a text area?

Bidge

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9386
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Working in Inches

Post by richmond62 » Sat Jul 15, 2017 7:40 am

Well the first thing you'll have to worry about is a conversion routine from inches to points,
after that everything should be remarkably straightforward: well, always remembering that a 600 pixel wide stack on
my display when it is set at 640 x 480 looks far bigger inches-wise than when my display is set at 1920 x 1080.

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

Re: Working in Inches

Post by bidgeeman » Sat Jul 15, 2017 7:48 am

Hi richmond62.
What about people who use inches to measure something like in the US. How do they go about inputing a measurement in inches?
I tried adding 3 1/3 + 1 1/2 of course LC didn't know what the hell was going on :)

Bidge

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9386
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Working in Inches

Post by richmond62 » Sat Jul 15, 2017 8:04 am

Well . . .

1. I'm not American.

2. I don't like Napoleonic units so I'm fine with inches.

3. You can have inches and 'traditional' divisions of inches: quarter, half, three-quarters

or you could be a "bit metric" and divide your inches up into 10 subunits (much easier).

If you want to "fool around" with quarters and so forth the first thing you're going to need to do is use proper symbols for the
fractions rather than 'one slash three' . . .

http://www.unicode.org/charts/PDF/U0080.pdf

Unicode addresses: quarter BC , half BD , three-quarters BE

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

Re: Working in Inches

Post by bidgeeman » Sat Jul 15, 2017 8:13 am

Hi richmond62.
That's very handy to know thanks :)

Bidge

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9386
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Working in Inches

Post by richmond62 » Sat Jul 15, 2017 8:44 am

Bl**dy silly really:
incher.png
Last edited by richmond62 on Sat Jul 15, 2017 9:54 am, edited 1 time in total.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9386
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Working in Inches

Post by richmond62 » Sat Jul 15, 2017 8:48 am

This Unicode table gives you loads more vulgar fractions:

http://www.unicode.org/charts/PDF/U2150.pdf

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

Re: Working in Inches

Post by bidgeeman » Sat Jul 15, 2017 9:49 am

You would think it would make more sense to type in a decimal rather than a fraction?
Very nice stack though :D
Bidge

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9386
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Working in Inches

Post by richmond62 » Sat Jul 15, 2017 9:56 am

Nutty Fruitcakes . . .
incher2.png
INCHER.livecode.zip
Here's the stack
(2.52 KiB) Downloaded 189 times

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9386
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Working in Inches

Post by richmond62 » Sat Jul 15, 2017 9:58 am

You would think it would make more sense to type in a decimal rather than a fraction?
Well, frankly, I'll always go for "two slash three" rather than .666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666 :D

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

Re: Working in Inches

Post by bidgeeman » Sat Jul 15, 2017 10:40 am

That's right...always looking for the easy solution ;)

Bidge

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9663
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Working in Inches

Post by dunbarx » Sat Jul 15, 2017 2:18 pm

So, bidgeeman, the banter aside, are you clear and comfortable about pixels, inches and screen resolution?.

Craig Newman

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

Re: Working in Inches

Post by bidgeeman » Sat Jul 15, 2017 2:24 pm

Hi Craig.
Yes thank you almost :) If I have any more problems I will post here. Thank you so much for asking :)

Bidge

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

Re: Working in Inches

Post by bidgeeman » Tue Jul 18, 2017 12:20 am

This is driving me nuts mainly because my math is not my strength.

I am trying to convert ruler measurements to onscreen positions
for people who need to print pre-cut labels on an A4 sheet accurately
by measuring the sheet cut positions with a ruler and filling out 6 fields.
Side, Top, Side gap and Base gap, Label width, Label Height.

This works perfectly with millimeters using this equation:
(mm) =595(screen pixel width) x 25.4 (amount of mm in an inch) / 72 (dpi)
Answer: 209.9027 (rounded off)
Divide this by 595(screen pixels) and you get:
0.3527(rounded off)
0.3527 is equivalent on screen to 1mm on a ruler which is easy to read and write
as there are 10 millimeters to 1 cm.

The problem is trying to convert this all to inches!
1 inch is divided into 16 and I need 1 x field where you can type the inch value and
another field for the 16/th value, then add them together but I can't get it to work when I
add the two fields together.
I'm guessing problem is that inches are divided into 16 so to get a conversion value that works,
the width, 595, has to be split into 16ths?
I just don't know how to arrive at the correct pixel value for a 16th of an inch at 595 pixels at 72 dpi?


I hope I have explained this correctly.
Can anyone help?
Thanks
Bidge

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Working in Inches

Post by bogs » Tue Jul 18, 2017 3:53 am

bidge, I hope this helps you out a bit. I am by no means a strong math type either, so I cheat a LOT ! Since I see from your examples that your "rounding off" a few times, perhaps that chart will be of some use.

As far as what an inch can be divided into, the possibilities are endless. When I worked in a machine shop, we worked to thousandths of an inch. Later a great deal of shops switched over to metric, or used both. Most standard rulers are divided into 16ths of an inch, as you point out. A great number are (depending on your field) going to be in 32nds or even 64ths.

Another way you could tackle it is to take your own figures. If 25.4 is the number of millimeters in an inch, and you already have a working formula for mm measuring, use that to come to your inch measurements, i.e. 25.4 / 16 would give you the number of mm in 1/16th of an inch, then you plug that into your formula. In one way this is easier, but more complicated, and it certainly is one way you can tackle it.

Yet a 3rd way to figure out what you need to know might be using a photo-editing program, like gimp or photoshop or a gazillion others. I know that most have a scaling section, where you can scale according to pixels, %'s, inches, etc. If you have a picture of whatever size, you can scale it using 1/16th of an inch, then hit scale again to see what it is in pixels at that point. While this is more work, it would certainly give you the number of pixels in 1/16th of an inch at any number of dpi.

As I said, I hope this helps you a bit.
Image

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”