ScintillaGadget()

Syntax

Result = ScintillaGadget(#Gadget, x, y, Width, Height, @Callback())
Description
Creates a new scintilla editing control in the current GadgetList. InitScintilla() has to be called successfully before using this command.

Parameters

#Gadget A number to identify the new gadget. #PB_Any can be used to auto-generate this number.
x, y, Width, Height The position and dimensions of the new gadget.
@Callback() The address of a procedure to receive events from the control. It must be defined as follows, where 'Gadget' is the gadget number of the control and *scinotify points to a structure with information on the event:

  Procedure ScintillaCallBack(Gadget, *scinotify.SCNotification)
    ; You code here
  EndProcedure

Return value

Nonzero on success, zero otherwise. If #PB_Any was used as the #Gadget parameter then the return-value is the auto-generated gadget number on success.

Remarks

The following events are supported through EventType():
  #PB_EventType_RightClick
After creation, Scintilla specific commands may be sent to the control with the ScintillaSendMessage() command. In addition common gadget commands like ResizeGadget() or HideGadget() may be used with the control as well.

Example

  If OpenWindow(0, 0, 0, 330, 90, "ScintillaGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    
    If InitScintilla()
      ScintillaGadget(0, 10, 10, 320, 70, 0)
      
      ; Output set to red color
      ScintillaSendMessage(0, #SCI_STYLESETFORE, 0, RGB(255, 0, 0))
      
      ; Set the initial text to the ScintillaGadget
      *Text=UTF8("This is a simple ScintillaGadget with text...")
      ScintillaSendMessage(0, #SCI_SETTEXT, 0, *Text)
      FreeMemory(*Text) ; The buffer made by UTF8() has to be freed, to avoid memory leak
      
      ; Adding a second line of text with linebreak before
      Text$ = Chr(10) + "Second line"
      *Text=UTF8(Text$)
      ScintillaSendMessage(0, #SCI_APPENDTEXT, Len(Text$), *Text)
      FreeMemory(*Text)
    EndIf
    
    Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
  EndIf

Supported OS

All

<- InitScintilla() - Scintilla Index - ScintillaSendMessage() ->