Try variants of this:
#constant NUM_VALS 3
// someplace to put the results
global dim g_vals[NUM_VALS] AS string
global dim g_prmpt[NUM_VALS] AS string
g_prmpt[1] = "Who"
g_prmpt[2] = "What"
g_prmpt[3] = "Where"
// flag to indicate we need inputs
global i_get_vals AS integer = 1
// set a size for the display
SetVirtualResolution(320,480)
// make big text
SetPrintSize(30)
// the main loop
do
// do we need inputs?
if i_get_vals = 1
// we need to get them
getSomeInputs()
else
// we have them, output them
for in_id=1 to NUM_VALS
print(g_prmpt[in_id]+":")
print(" '"+g_vals[in_id]+"'")
next in_id
endif
Sync()
loop
function createAnInput(in_id AS integer,ypos AS float,prmpt AS string)
// check to see if the edit box exists
if GetEditBoxExists(in_id) = 1 then exitfunction
// we need a text prompt
CreateText(in_id,prmpt)
SetTextPosition(in_id,10,ypos)
SetTextSize(in_id,30)
// figure out where to put the edit field
y# = ypos + 5 + GetTextTotalHeight(in_id)
// create the edit field
CreateEditBox(in_id)
SetEditBoxText(in_id,"")
SetEditBoxPosition(in_id,10,y#)
SetEditBoxSize(in_id,200,30)
SetEditBoxTextSize(in_id,30)
endfunction
function deleteAnInput(in_id AS integer)
if GetEditBoxExists(in_id) = 1 then DeleteEditBox(in_id)
if GetTextExists(in_id) = 1 then DeleteText(in_id)
endfunction
function createTheInputs()
// start near the top
ypos# = 50.0
for i=1 to NUM_VALS
// create the input
createAnInput(i,ypos#,g_prmpt[i])
// move down
ypos# = ypos# + 90.0
next i
// add the virtual button
AddVirtualButton(1,160, 430, 80)
endfunction
function getSomeInputs()
// check to see if we've created the input areas
if GetTextExists(1) = 0 then createTheInputs()
// now check for virtual button pressed
if GetVirtualButtonPressed(1) = 1
// get the values
for i=1 to NUM_VALS
// get the value
g_vals[i] = GetEditBoxText(i)
// clean up
deleteAnInput(i)
next i
// get rid of button
DeleteVirtualButton(1)
// all done
i_get_vals = 0
endif
endfunction
Yes, it could be done differently. This was just hashed together quickly.
Cheers,
Ancient Lady