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 ->