Splitview or opening the same file twice in the IDE
Posted: Sun Jan 28, 2018 12:43 am
Like requested in 2015 (http://www.purebasic.fr/english/viewtop ... 15&start=0)
I would prefer a splitview in the PureBasic IDE or at least the ability to open the same file in two IDE tabs.
Scintilla supports multi view of one document. See the following example code.
Run this code and edit the text. It will be changed in both views, because its internally only one document.
I would prefer a splitview in the PureBasic IDE or at least the ability to open the same file in two IDE tabs.
Scintilla supports multi view of one document. See the following example code.
Run this code and edit the text. It will be changed in both views, because its internally only one document.
Code: Select all
EnableExplicit
Procedure MakeScintillaText(text.s)
Static sciText.s
CompilerIf #PB_Compiler_Unicode
sciText = Space(StringByteLength(text, #PB_UTF8))
PokeS(@sciText, text, -1, #PB_UTF8)
CompilerElse
sciText = text
CompilerEndIf
ProcedureReturn @sciText
EndProcedure
If OpenWindow(0, 0, 0, 320, 180, "ScintillaGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
If InitScintilla()
ScintillaGadget(0, 10, 10, 300, 70, 0)
ScintillaGadget(1, 10, 100, 300, 70, 0)
; Ausgabe auf rote Farbe setzen
ScintillaSendMessage(0, #SCI_STYLESETFORE, 0, RGB(255, 0, 0))
; Anfänglichen Text des ScintillaGadgets festlegen
ScintillaSendMessage(0, #SCI_SETTEXT, 0, MakeScintillaText("Please type in some text in the top Scintilla Gadget"))
; Hinzufügen einer zweiten Zeile mit einem vorherigen Zeilenumbruch
Define Text$
Define *DocPointer
ScintillaSendMessage(0, #SCI_APPENDTEXT, Len(Text$), MakeScintillaText(Text$))
*DocPointer = ScintillaSendMessage(0, #SCI_GETDOCPOINTER, 0, 0)
Debug *DocPointer
ScintillaSendMessage(1, #SCI_SETDOCPOINTER, 0, *DocPointer)
EndIf
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf