WinMeasure 2

Post Reply
User avatar
rbytes
Posts: 1338
Joined: Sun May 31, 2015 12:11 am
My devices: iPhone 11 Pro Max
iPad Pro 11
MacBook
Dell Inspiron laptop
CHUWI Plus 10 convertible Windows/Android tablet
Location: Calgary, Canada
Flag: Canada
Contact:

WinMeasure 2

Post by rbytes »

I made some improvements.

1. Thanks to Mr. K's help, reduced the button creation code from 25 lines to 14.
2. The right toolbar Is now hidden, making the rulers slightly longer.
3. The hide and show commands are used to reveal the desired ruler.

You will need version 17 for it to run properly

Code: Select all

WinMeasure 2 by rbytes
September 2017
Uses graphic images of imperial and metric rulers
''

' hide the side toolbar
#.scrview(#.normal)               ' no side toolbar

' get screen size
mx,my = #.scrsize()

' declare button horizontal offset
shift = 40

' draw the inch ruler
a = #.image                       ' ruler image
  a.source = "ruler.jpg"
  a.width = 1760
  a.x = -19
  a.y = 0
  #.show(a)

' draw the metric ruler
b = #.image                       ' ruler image
  b.source = "ruler2.jpg"
  b.width = 1760
  b.x = -33
  b.y = 0
  #.show(b)

c = #.textbox 'is a text box. Pressing "Enter" key if multi is 0 registers an action. Group elements are:
  c.edit = 1 'if 0 then text box is a non-editable text label (default), otherwise text box is an editable text field for text input;
  c.height = 400
  multi = 1 ' if 0 then text box is single-line (default), otherwise it is multi-line;
  c.text = "Notes: " 'text inside text box;
  c.width = mx 'text box width;
  c.x = 0 ' offset from left screen border;
  c.y = 70 'offset from top screen border.
  #.show(c)

' create default button
mb = #.button
  mb.height = 50
  mb.width = 100
  mb.y = 360

' create four new buttons from default button
d,e,f,g = mb

  ' set specific button parameters
  d.text = "I N C H"
  d.x = 300 + shift
  e.text = "C E N T"
  e.x = 450 + shift
  f.text = "S A V E"
  f.x = 600 + shift
  g.text = "Q U I T"
  g.x = 750 + shift
  #.show(d,e,f,g)

:loop

  ? #.act(d)
    #.hide(b)
    b.x = -19
  .
  ? #.act(e) 
    #.show(b)
    b.x = -33
  .
  ? #.act(f)
    k = "Notes.txt"
    #.writetext(k,c.text)
  .

  ? #.act(g), #.end()

#.delay(.1)
loop ->
''
Attachments
Screenshot (45).png
Screenshot (45).png (187.46 KiB) Viewed 2437 times
The only thing that gets me down is gravity...

User avatar
Mr. Kibernetik
Site Admin
Posts: 4786
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPhone, iPad, MacBook
Location: Russia
Flag: Russia

Re: WinMeasure 2

Post by Mr. Kibernetik »

Will knowing the screen DPI help you to make an image-independent ruler?
If yes, then I can make a function returning DPI of the screen - and you can draw your own custom ruler on the screen.

User avatar
rbytes
Posts: 1338
Joined: Sun May 31, 2015 12:11 am
My devices: iPhone 11 Pro Max
iPad Pro 11
MacBook
Dell Inspiron laptop
CHUWI Plus 10 convertible Windows/Android tablet
Location: Calgary, Canada
Flag: Canada
Contact:

Re: WinMeasure 2

Post by rbytes »

Yes, that would eliminate everyone having to calibrate the rulers. If you make the function I will incorporate it into WinMeasure 3.

Someone should invent a small device with a rubber roller and a digital output that plugs into a Lightning jack. Then one could measure big objects with it.
The only thing that gets me down is gravity...

User avatar
Mr. Kibernetik
Site Admin
Posts: 4786
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPhone, iPad, MacBook
Location: Russia
Flag: Russia

Re: WinMeasure 2

Post by Mr. Kibernetik »

rbytes wrote:
Sun Sep 17, 2017 10:14 pm
Yes, that would eliminate everyone having to calibrate the rulers. If you make the function I will incorporate it into WinMeasure 3.

Someone should invent a small device with a rubber roller and a digital output that plugs into a Lightning jack. Then one could measure big objects with it.
A suggestion: you can draw CM ruler on one side and INCH ruler on another side of the device. So you will make an iRule Pro :!:

User avatar
rbytes
Posts: 1338
Joined: Sun May 31, 2015 12:11 am
My devices: iPhone 11 Pro Max
iPad Pro 11
MacBook
Dell Inspiron laptop
CHUWI Plus 10 convertible Windows/Android tablet
Location: Calgary, Canada
Flag: Canada
Contact:

Re: WinMeasure 2

Post by rbytes »

Would people believe it was a pro version if it had one less button? :lol:
But I could add buttons to change colors of the rulers.
The only thing that gets me down is gravity...

User avatar
Mr. Kibernetik
Site Admin
Posts: 4786
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPhone, iPad, MacBook
Location: Russia
Flag: Russia

Re: WinMeasure 2

Post by Mr. Kibernetik »

rbytes wrote:
Sun Sep 17, 2017 10:23 pm
Would people believe it was a pro version if it had one less button? :lol:
But I could add buttons to change colors of the rulers.
Yes, changing rule color is also a sign of a pro tool.

User avatar
Mr. Kibernetik
Site Admin
Posts: 4786
Joined: Mon Nov 19, 2012 10:16 pm
My devices: iPhone, iPad, MacBook
Location: Russia
Flag: Russia

Re: WinMeasure 2

Post by Mr. Kibernetik »

rbytes wrote:
Sun Sep 17, 2017 10:14 pm
Yes, that would eliminate everyone having to calibrate the rulers. If you make the function I will incorporate it into WinMeasure 3.
Version with this function is published.

Post Reply