Page 1 of 1

EnableExplicit breaks GetMobileText() in SB 3.1 — fixed in 3.2

Posted: Sun Apr 19, 2026 5:08 am
by chikega
While working on a SpiderBasic Mobile project on version 3.1, I stumbled on an odd interaction between EnableExplicit and the Mobile library. I ran a series of minimal tests to isolate the behavior, then confirmed it is fixed in 3.2. Posting here for anyone still on 3.1 who hits the same wall.

Test 1 — Mobile string-returning built-in under EnableExplicit

Code: Select all

EnableExplicit

If ContainerMobile(#PB_Any, #PB_Mobile_Page)
  InputMobile(1, "test", "", #PB_Mobile_Numeric)
  CloseMobileContainer()
EndIf

Procedure MobileEvents()
  Debug GetMobileText(1)
EndProcedure

BindEvent(#PB_Event_Mobile, @MobileEvents())
❌ Fails on 3.1: GetMobileText() is not a function, array, list, map or macro.

✅ Passes on 3.2.

Code: Select all

Calling GetMobileText$() on 3.1 produces the identical error — the $ suffix is not the issue.

Test 2 — User-defined string-returning procedure under EnableExplicit

[code]EnableExplicit

Procedure.s MyTest()
  ProcedureReturn "hello"
EndProcedure
Debug MyTest()
✅ Passes on 3.1 and 3.2. EnableExplicit has no problem with user-defined string-returning procedures.

Test 3 — Standard built-in string-returning function under EnableExplicit

Code: Select all

EnableExplicit

Define.s result
result = Str(42)
Debug result
✅ Passes on 3.1 and 3.2. EnableExplicit has no problem with standard built-in string-returning functions like Str().

Test 4 — Mobile built-in returning an integer under EnableExplicit

Code: Select all

EnableExplicit

If ContainerMobile(#PB_Any, #PB_Mobile_Page)
  InputMobile(1, "test", "", #PB_Mobile_Numeric)
  CloseMobileContainer()
EndIf

Procedure MobileEvents()
  Debug Str(GetMobileState(1))
EndProcedure

BindEvent(#PB_Event_Mobile, @MobileEvents())
✅ Passes on 3.1 and 3.2. EnableExplicit has no problem with Mobile built-ins that return an integer.

Test 5 — Mobile built-in accepting a string parameter under EnableExplicit

Code: Select all

EnableExplicit

If ContainerMobile(#PB_Any, #PB_Mobile_Page)
  TextMobile(1, "hello")
  CloseMobileContainer()
EndIf

Procedure MobileEvents()
  SetMobileText(1, "world")
EndProcedure

BindEvent(#PB_Event_Mobile, @MobileEvents())
✅ Passes on 3.1 and 3.2. EnableExplicit has no problem with Mobile built-ins that accept a string parameter.

Summary
On SpiderBasic 3.1, the failure is precisely isolated to Mobile built-ins that return a string. All other combinations — user string procedures, standard string built-ins, Mobile integer-returning functions, Mobile string-accepting functions — compile and run normally under EnableExplicit on both versions.
The workaround on 3.1 is simply to omit EnableExplicit in SpiderBasic Mobile projects. Upgrading to 3.2 resolves the issue entirely.