EditorGadget()

Syntax

Result = EditorGadget(#Gadget, x, y, Width, Height [, Flags])
Description
Creates an Editor gadget in the current GadgetList. If #PB_Any is used as '#Gadget' parameter, the new gadget number will be returned as 'Result'. #Gadget will be the number returned by the EventGadget() command.

'Flags' can be the following value:
  #PB_Editor_ReadOnly: The user cannot edit the text in the gadget.
You can add a 'mini help' to this gadget by using GadgetToolTip().

The following commands can be used to act on the editor content:

- AddGadgetItem(): Add a text line.
- CountGadgetItems(): Return the number of lines in the editor gadget.
- GetGadgetItemText(): Get the specified line text.
- GetGadgetText(): Get the text content of the editor gadget.
- RemoveGadgetItem(): Remove a line in the editor.
- ClearGadgetItemList(): Clear the text content.
- SetGadgetItemText(): Set the specified line text.
- SetGadgetText(): Change the text content of the editor gadget.
- SetGadgetAttribute(): With the following attribute:
  #PB_Editor_ReadOnly: Set the readonly state. (0 means editable, nonzero means readonly)
- GetGadgetAttribute(): With the following attribute:
  #PB_Editor_ReadOnly: Get the readonly state. (0 means editable, nonzero means readonly)

This gadget supports the SetGadgetColor() and GetGadgetColor() commands with the following values as 'ColorType':
  #PB_Gadget_BackColor      : backgroundcolor
  #PB_Gadget_FrontColor     : textcolor
Example:
  If OpenWindow(0, 0, 0, 322, 150, "EditorGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) And CreateGadgetList(WindowID(0)) 
    EditorGadget(0, 8, 8, 306, 133) 
    For a = 0 To 5 
      AddGadgetItem(0, a, "Line "+Str(a)) 
    Next 
    Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow 
  EndIf 

Supported OS

All

<- DisableGadget() - Gadget Index - ExplorerComboGadget() ->