the screenie looks nice
otherwise, i would use dummy sprites for a lookup table. a start:
// Project: GetEditBox
// Created: 2023-04-07
// show all errors
SetErrorMode(2)
// set window properties
SetWindowTitle( "GetEditBox" )
SetWindowSize( 640,360, 0 )
SetWindowAllowResize( 1 ) // allow the user to resize the window
// set display properties
SetVirtualResolution( 640,360 ) // doesn't have to match the window
SetOrientationAllowed( 1, 1, 1, 1 ) // allow both portrait and landscape on mobile devices
SetSyncRate( 30, 0 ) // 30fps instead of 60 to save battery
SetScissor( 0,0,0,0 ) // use the maximum available screen space, no black borders
UseNewDefaultFonts( 1 ) // since version 2.0.22 we can use nicer default fonts
CenterWindow()
Type Box
SprID, BoxID, Label$
EndType
GLOBAL CurrentBox, Boxes as Box []
MakeBoxes()
do
Index = GetEditBox()
If Index > -1
Print(Boxes[Index].Label$ + " (" + STR(Boxes[Index].BoxID) + ")")
Print(GetEditBoxText(Boxes[Index].BoxID))
EndIf
Sync()
loop
Function GetEditBox()
ThisBox = Boxes.Find(GetSpriteHit(GetPointerX(), GetPointerY()))
EndFunction ThisBox
Function MakeBoxes()
ThisBox as Box
For x = 1 to 10
ThisBox.Label$ = "Edit Box #" + STR(x)
ThisBox.BoxID = CreateEditBox()
SetEditBoxPosition(ThisBox.BoxID, 200, x*20)
SetEditBoxText(ThisBox.BoxID, "Box " + STR(x) + " Contents")
ThisBox.SprID = CreateDummySprite()
SetSpriteSize(ThisBox.SprID, GetEditBoxWidth(ThisBox.BoxID), GetEditBoxHeight(ThisBox.BoxID))
SetSpritePosition(ThisBox.SprID, GetEditBoxX(ThisBox.BoxID), GetEditBoxY(ThisBox.BoxID))
Boxes.InsertSorted(ThisBox)
Next x
EndFunction
Function CenterWindow()
X = GetMaxDeviceWidth()/2.0 - GetWindowWidth()/2.0
Y = GetMaxDeviceHeight()/2.0 - GetWindowHeight()/2.0
SetWindowPosition( X,Y)
EndFunction