Page 1 of 1

Problem with buttons

Posted: Fri Sep 15, 2017 5:29 pm
by rbytes
It seems I can only detect one of my 4 buttons, the first one defined. How do I detect the others?

Code: Select all

''
WinMeasure by rbytes
September 2017
Uses graphic images of imperial and metric rulers
''
'#.drawrect(160,255,343,500)        ' used only for setting digit sizes and offsets
#.angle(#.degrees)
mx,my = #.scrsize()
'#.scrclear(.5,.5,.5)
#.drawrotate(0,0,180)
' draw the imperial ruler
''
b = #.image                       ' ruler image
  b.source = "ruler2.jpg"
  b.width = 1760
  b.x = -33
  b.y = 0
  #.show(b)
  #.scr()
''

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)
  #.scr()

:loop
d = #.button
  d.height = 50
  d.text = "INCHES"
  d.width = 100
  d.x = 300
  d.y = 360

e = #.button
  e.height = 50
  e.text = "CENTIM"
  e.width = 100
  e.x = 450
  e.y = 360

f = #.button
  f.height = 50
  f.text = "SAVE"
  f.width = 100
  f.x = 600
  f.y = 360

g = #.button
  g.height = 50
  g.text = "QUIT"
  g.width = 100
  g.x = 750
  g.y = 360

  #.show(d,e,f,g)
  #.scr()

>
  ? #.act(d), #.output("D")
<


>
  ? #.act(e), #.output("E")
<

>
  ? #.act(f), #.output("F")
<


>
  ? #.act(g), #.output("G")
<

loop ->

Re: Problem with buttons

Posted: Fri Sep 15, 2017 5:38 pm
by Mr. Kibernetik
This one

Code: Select all

>
  ? #.act(d), #.output("D")
<
is an eternal cycle, because both ">" (cycle begin) and "<" (cycle repeat) commands have no conditions specified, which means that they just execute all the time. Please look at documentation about loops.

Re: Problem with buttons

Posted: Fri Sep 15, 2017 5:51 pm
by rbytes
Got it. Thanks.

Yesterday I knew this, but today ??? :(