EditorGadget()

Syntax

Result = EditorGadget(#Gadget, x, y, Width, Height [, Flags])
Description
Creates an Editor gadget in the current GadgetList.

Parameters

#Gadget Specifies a number to identify the new gadget. #PB_Any can be used to autogenerate this number.
x, y, Width, Height Specifies the position and dimensions of the new gadget.
Flags (optional) Specifies optional flags to modify the gadget behavior. This can be the following value:
  #PB_Editor_ReadOnly: The user cannot edit the text in the gadget.

Return value

Returns nonzero on success and zero on failure. If #PB_Any was used as the #Gadget parameter then the returnvalue is the autogenerated gadget number on success.

Remarks

You can add a 'mini help' to this gadget by using GadgetToolTip().

The following functions 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.
- ClearGadgetItems(): 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() functions 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)
    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

See Also

AddGadgetItem(), RemoveGadgetItem(), CountGadgetItems(), ClearGadgetItems(), GetGadgetText(), SetGadgetText(), GetGadgetItemText(), SetGadgetItemText(), GetGadgetAttribute(), SetGadgetAttribute(), GetGadgetColor(), SetGadgetColor(), StringGadget()

Supported OS

All

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