Scui textgadgets
Posted: Mon Mar 23, 2026 4:00 pm
I have been fidling a bit with the ScuiLib package. I wanted to see if I could add some input gadgets to a prject without having to rewrite everything into RapaGUI.
It does work quite well, even on Android which is the end target for my project.
All I had to change to make it work on android was the font setting in the ScuiLib.hws at line 2015. Changed it into: SetFont(#SANS, 18)
For some reason it refers to the helvetica font, although I am not sure where that is specified. I cound not find any references to that font type in the ScuiLib.hws script.
Here is a test code I wrote. It just creates a string gadget and a button, invokes the Android keyboard when the string is activated. The button reads the gadget text into a variable and displays it.
I am guessing that the scui.Set command could be used to set the gadget string value, but I have not succeded yet to figure out how that works.
Another thing I wonder the lines setting used when defining the text gadget. It is currenty set to Lines = 1, but setting it to more Lines makes no difference. It would be nice to be able to use multiple lines like a textbox.
Also how can I set the font from my own script, instead of having to edit the ScuiLib.hws file?
It does work quite well, even on Android which is the end target for my project.
All I had to change to make it work on android was the font setting in the ScuiLib.hws at line 2015. Changed it into: SetFont(#SANS, 18)
For some reason it refers to the helvetica font, although I am not sure where that is specified. I cound not find any references to that font type in the ScuiLib.hws script.
Here is a test code I wrote. It just creates a string gadget and a button, invokes the Android keyboard when the string is activated. The button reads the gadget text into a variable and displays it.
Code: Select all
@INCLUDE "ScuiLib.hws"
@DISPLAY {Title = "SCUI string test", Width = 720, Height = 480, COLOR = #WHITE, ScaleMode = #SCALEMODE_AUTO, FitScale = True, Orientation = #ORIENTATION_LANDSCAPE, SmoothScale = True}
ta = GetVersion()
Function ButtonID(mess)
Switch mess.id
Case 1:
Switch mess.event
Case "OnClick":
If ta.platform = "Android" Then ShowKeyboard()
EndSwitch
Case 2:
Switch mess.event
Case "OnPushed":
text1 = scui.Get("StringBox")
SetFillStyle(#FILLCOLOR)
Box(10, 100, 710, 20, #WHITE)
TextOut(10, 100, "StringBox: "..text1.value)
If ta.platform = "Android" Then HideKeyboard()
EndSwitch
EndSwitch
EndFunction
scui.NewObject( #IFOCLASS_STRINGBOX, "StringBox",
{ x = 10, y = 10 },
{ x = 460, y = 30 },
{ Enabled = #IFO_ENABLED },
{ Values = { "This is a string box, it will accept almost any characters..." }, Lines = 1,
InputType = #GETKEY_ALL,
;Custom = "ABC123",
Clear1st = 1,
MaxLen = 100, },
{ OnExit = ButtonID, OnChange = ButtonID, OnKeyPress = ButtonID, OnClick = ButtonID } )
scui.NewObject( #IFOCLASS_BUTTON, "AlignLeft",
{ x = 475, y = 10 },
{ x = 150, y = 30 },
Nil,
{ Values = { "Get text from string"}, Lines = 1 },
{ OnPushed = ButtonID } )
Repeat
WaitEvent
Forever
Another thing I wonder the lines setting used when defining the text gadget. It is currenty set to Lines = 1, but setting it to more Lines makes no difference. It would be nice to be able to use multiple lines like a textbox.
Also how can I set the font from my own script, instead of having to edit the ScuiLib.hws file?