Bisonte wrote:@Infratec:
You missed the part about the "external tool".
So you don't have the PB_Gadget_Object Number. Only the OS ID of the scintilla....
Maybe it works when importing the external gadgetID into the gadget objects,
so you can use ScintillaSendMessage() with the external scintilla control?
Code: Select all
CompilerIf #PB_Compiler_OS = #PB_OS_Windows
Import ""
CompilerElse
ImportC ""
CompilerEndIf
PB_Object_GetOrAllocateID.i(*Object, ID)
PB_Gadget_Objects.i
EndImport
EnableExplicit
Procedure.i ImportScintillaID(gadgetID)
Protected *gadget.Integer = PB_Object_GetOrAllocateID(PB_Gadget_Objects,#PB_Any)
If *gadget
*gadget\i = gadgetID
ProcedureReturn *gadget
EndIf
EndProcedure
Procedure InsertHandler(SourceGadget.i, TargetScintillaGadget.i)
Protected *textBuffer
If IsGadget(TargetScintillaGadget)
*textBuffer = UTF8(#LF$+"; Code inserted by Vector Curve Designer" +
#LF$+GetGadgetText(SourceGadget)+#LF$ +
"; End of Curve Designer Code"+#LF$)
If *textBuffer
ScintillaSendMessage(TargetScintillaGadget, #SCI_REPLACESEL, #Null, *textBuffer)
FreeMemory(*textBuffer)
EndIf
Else
MessageRequester("Notice:","Scintilla editor not found!"+#LF$+#LF$ +
"Invoke Curve Designer tool from the PureBasic IDE for this feature.")
EndIf
EndProcedure
Define Event.i, scintilla, scintillaID
If InitScintilla()
OpenWindow(0,0,0,400,300,"")
StringGadget(0, 10, 10, 380, 70, "Hello world!")
ScintillaGadget(1, 10, 90, 380, 160, #Null)
ButtonGadget(2, 10, 270, 50, 20, "Replace")
scintillaID = GadgetID(1) ;Val(GetEnvironmentVariable("PB_Tool_Scintilla"))
scintilla = ImportScintillaID( scintillaID )
InsertHandler(0, scintilla)
Repeat
Event = WaitWindowEvent()
If event = #PB_Event_Gadget And EventGadget() = 2
InsertHandler(0, scintilla)
EndIf
Until Event = #PB_Event_CloseWindow
EndIf
For security reasons you shouldn't be able to access the memory of other processes easily, but it seems to work on Windows OS?