Are you able to fill a simple input window?

Post Reply
Henko
Posts: 842
Joined: Tue Apr 09, 2013 12:23 pm
My devices: iPhone,iPad
Windows
Location: Groningen, Netherlands
Flag: Netherlands

Are you able to fill a simple input window?

Post by Henko »

The input window generated by this little program contains 4 input fields and an “ok” button to confirm the entered data.
Let’s see if you can finish the input windoe in a proper way.
The first three field must reach recieve at least 3 characters.
The fourth field must recieve a number.
Don’t forget to use the “return” key to confirm each field content, and to use the “OK” button to close the window.

I managed to finish the input window, and needed 10.7 second.
IMG_1382.jpeg
IMG_1382.jpeg (269.53 KiB) Viewed 27 times

Code: Select all

init_prog()
speed=2 ! alfa=1 ! t_start=time()
page "Staff" show
pause 2
for i=0 to .7 step .01
  speed*=.85 ! alfa*=.95 ! pause max(.1,speed)
  page "Staff" alpha alfa
  page "Staff" at 50+rnd(250),150+rnd(300)
  for k=1 to 4
    fld$="Staff"&k ! if not field_changed(fld$) then continue
    inp$(k)=field_text$(fld$)
    next k
  if button_pressed("Staff_ok") then
    page "Staff" hide
    break
    end if
  next i
dt=time()-t_start
ok=1
for i=1 to 3
  if len(inp$(i))<3 then
    ok=0 ! break
    end if
  next i
if val(inp$(4))=0 then ok=0
graphics clear ! text
print ! print ! print "   ";
if ok=0 then
  print "You could not properly fill the input window!!"
  else 
  print "You succesfully filled the input window in "&dt&" sec"
  end if
end

def init_prog()
graphics ! graphics clear ! draw color 0,0,0
for i=50 to 700 step 15 ! draw line i,150 to i,750 ! next i
define_staff_form("Staff","New staff member",150,300,420,320,.5,.7,.7,1)
'
'
end def


' define a paged (input)window 
' open and close with command page show and page hide
' other page commands in manual
' 
def define_staff_form(name$,titel$,xs,ys,ww,hh,R,G,B,alpha)

        ' stuff for all input forms
page name$ set 
page name$ frame xs,ys,ww,hh
page name$ color R,G,B,alpha
set buttons custom
button name$ & "_bottom" text "" at -6,hh-3 size ww+12,3
button name$ & "_left"   text "" at 0,-6 size 3,hh+12
button name$ & "_right"  text "" at ww-3,-6 size 3,hh+12
button name$ & "_upper1" text "" at -6,0 size ww+12,3
button name$ & "_upper2" text "" at -6,30 size ww+12,3
button name$ & "_title"  text titel$ at 120,3 size 180,27
button name$ & "_ok" text "ok" at 170,260 size 80,40

        ' application specific content
n$=" full name       : "
field name$ & "name" text n$ at 10,40 size 150,40 RO
field name$ & "1" text "" at 170,40 size 240,40
field_refine(name$ & "name")
n$=" department      : "
field name$ & "dept" text n$ at 10,90 size 150,40 RO
field name$ & "2" text "" at 170,90 size 240,40
field_refine(name$ & "dept")
n$=" date of birth    : "
field name$ & "birth" text n$ at 10,140 size 150,40 RO
field name$ & "3" text "" at 170,140 size 240,40
field_refine(name$ & "birth")
n$=" salary (/year)   : "
field name$ & "salary" text n$ at 10,190 size 150,40 RO
field name$ & "4" text "" at 170,190 size 240,40
field_refine(name$ & "salary")
page name$ hide
end def

def field_refine(f$)
field f$ font size 24 ! field f$ font color 0,0,0
field f$ back color .5,.7,.7 ! field f$ back alpha .2
field f$ font name "Baskerville-Italic"
end def








Chooch912
Posts: 56
Joined: Thu Apr 12, 2018 6:16 pm
My devices: iPad
Flag: United States of America

Re: Are you able to fill a simple input window?

Post by Chooch912 »

Nope, I'm just too old with very slow reaction times and I cannot finish.
Cute program.

Post Reply