StringGadget()

Syntax

Result = StringGadget(#Gadget, x, y, Width, Height, Content$ [, Flags])
Description
Creates a String gadget in the current GadgetList. If #PB_Any is used as '#Gadget' parameter, the new gadget identifier will be returned as 'Result'. #Gadget will be the number returned by EventGadgetID() command. 'Content$' specifies the initial content of this StringGadget.

'Flags' are always optional and can be composed of one of the following constants:
  #PB_String_Numeric    : Only numbers are accepted.
  #PB_String_Multiline  : Several lines of text are accepted.
  #PB_String_Password   : Password mode, displaying only '*' instead of normal characters.
  #PB_String_ReadOnly   : Read only mode. No text can be entered.
  #PB_String_LowerCase  : All characters are converted to lower case automatically.
  #PB_String_UpperCase  : All characters are converted to upper case automatically.
  #PB_String_BorderLess : No borders are drawn around the gadget.

Later the content can be changed with SetGadgetText() and received with GetGadgetText().

The following events are supported through EventType():
  #PB_EventType_Change    : The text has been modified by the user.
  #PB_EventType_Focus     : The StringGadget got the focus.
  #PB_EventType_LostFocus : The StringGadget lost the focus.
You can add a 'mini help' to this gadget by using GadgetToolTip().

Example:
  ; Shows possible flags of StringGadget in action...
  If OpenWindow(0,0,0,322,275,#PB_Window_SystemMenu|#PB_Window_ScreenCentered,"StringGadget Flags") And CreateGadgetList(WindowID(0))
    StringGadget(0,8, 10,306,20,"Normal StringGadget...")
    StringGadget(1,8, 35,306,20,"1234567",#PB_String_Numeric)
    StringGadget(2,8, 60,306,20,"Readonly StringGadget",#PB_String_ReadOnly)
    StringGadget(3,8, 85,306,20,"lowercase...",#PB_String_LowerCase)
    StringGadget(4,8,110,306,20,"uppercase...",#PB_String_UpperCase)
    StringGadget(5,8,140,306,20,"Borderless StringGadget",#PB_String_BorderLess)
    StringGadget(6,8,170,306,20,"Password",#PB_String_Password)
    StringGadget(7,8,205,306,60,"Multiline StringGadget..."+Chr(13)+Chr(10)+"second line...",#PB_String_Multiline)
    Repeat : Until WaitWindowEvent()=#PB_Event_CloseWindow
  EndIf

Supported OS

All

<- SplitterGadget() - Gadget Index - TextGadget() ->