Page 1 of 1

WinMeasure 2

Posted: Sun Sep 17, 2017 8:01 pm
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 ->
''

Re: WinMeasure 2

Posted: Sun Sep 17, 2017 8:17 pm
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.

Re: WinMeasure 2

Posted: Sun Sep 17, 2017 10:14 pm
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.

Re: WinMeasure 2

Posted: Sun Sep 17, 2017 10:20 pm
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 :!:

Re: WinMeasure 2

Posted: Sun Sep 17, 2017 10:23 pm
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.

Re: WinMeasure 2

Posted: Sun Sep 17, 2017 10:31 pm
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.

Re: WinMeasure 2

Posted: Mon Sep 18, 2017 1:26 am
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.