Problem with buttons

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:

Problem with buttons

Post 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 ->
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: Problem with buttons

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

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: Problem with buttons

Post by rbytes »

Got it. Thanks.

Yesterday I knew this, but today ??? :(
The only thing that gets me down is gravity...

Post Reply