ScintillaGadget()

Syntax

Result = ScintillaGadget(#Gadget, x, y, Width, Height, @Callback())
Description
Creates a new scintilla editing control in the current GadgetList. If #PB_Any is used as '#Gadget' parameter, the new gadget number will be returned as 'Result'.

'@callback()'should be 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:

  ProcedureDLL ScintillaCallBack(Gadget, *scinotify.SCNotification)
    ;
    ; The ProcedureDLL declaration is important for the callback to work correctly on MacOSX,
    ; on all other OS it has no effect.
    ;
  EndProcedure

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, 320, 90, "ScintillaGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  
     If InitScintilla()
        ScintillaGadget(0, 10, 10, 300, 70, #Null)
        
        ; Output set to red color
        ScintillaSendMessage(0, #SCI_STYLESETFORE, 0, RGB(255, 0, 0))
        
        ; Set the initial text to the ScintillaGadget
        ScintillaSendMessage(0, #SCI_SETTEXT, 0, @"This is a simple ScintillaGadget with text...")
        
        ; Adding a second line of text with linebreak before
        Text$ = Chr(10) + "Second line"
        ScintillaSendMessage(0, #SCI_APPENDTEXT, Len(Text$), @Text$)
     EndIf
     
     Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
  EndIf

Supported OS

All

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