To complete the code Rashad,
You can remove the horizontal scroll.
Code:
ScintillaSendMessage(0, #SCI_SETHSCROLLBAR, 0)
SetGadgetText not work. replaced by
Code:
ScintillaSendMessage(0, #SCI_SETTEXT, 0, @"Hello")
GettGadgetText not work. replaced by this procedure
Code:
Procedure.s ScintillaGetText(Gadget.l)
Protected SciLength.i, *MemoryID.l, Buffer.s
SciLength = ScintillaSendMessage(Gadget, #SCI_GETLENGTH)+1
*MemoryID = AllocateMemory(SciLength)
If *MemoryID
ScintillaSendMessage(Gadget, #SCI_GETTEXT, SciLength, *MemoryID)
Buffer=PeekS(*MemoryID)
FreeMemory(*MemoryID)
EndIf
ProcedureReturn(Buffer)
EndProcedure
Rashad code updated
Code:
Procedure.s ScintillaGetText(Gadget.l)
Protected SciLength.i, *MemoryID.l, Buffer.s
SciLength = ScintillaSendMessage(Gadget, #SCI_GETLENGTH)+1
*MemoryID = AllocateMemory(SciLength)
If *MemoryID
ScintillaSendMessage(Gadget, #SCI_GETTEXT, SciLength, *MemoryID)
Buffer=PeekS(*MemoryID)
FreeMemory(*MemoryID)
EndIf
ProcedureReturn(Buffer)
EndProcedure
Procedure ScintillaSetText(Gadget.l, Buffer.s)
ScintillaSendMessage(Gadget, #SCI_SETTEXT, 0, @Buffer)
EndProcedure
If OpenWindow(0, 0, 0, 320, 90, "ScintillaGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
InitScintilla()
ScintillaGadget(0, 10, 10, 300, 40, #Null)
ScintillaSendMessage(0, #SCI_STYLESETFORE, 0, RGB(255, 0, 0))
ScintillaSendMessage(0, #SCI_SETHSCROLLBAR, 0)
ScintillaSetText(0, "Hello")
Debug ScintillaGetText(0)
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Quit = 1
Case #PB_Event_Gadget
Select EventGadget()
Case 0
If ScintillaSendMessage(0, #SCI_GETLINECOUNT) > 1
ScintillaSendMessage(0, #SCI_DELETEBACK)
EndIf
EndSelect
EndSelect
Until Quit = 1
EndIf