

The Low-Level API is complete except for prototype parameters that may be of the wrong type. It is possible to mix the High-Level API and the Low-Level API within the same project if the same *sciter instance is used. instead of property named SciterClassName it is named ClassName in the Low-Level API, this generally works better, compare *sciter\ClassName() instead of *sciter\SciterClassName() but it also plays well with High-Level API macros.Ĭonstants are always prefixed with SCITER_ and structures with Sciter to avoid naming coalitions. Sciter exports a function SciterAPI() that returns a struct, property names within the PureBasic structure does not always follow the original names from the C struct, properties are never prefixed with Sciter as they are sometimes done in the original, e.g. Located in src/sciterapi.pbi, works directly against what is exported from the Sciter dynamic library. The High-Level API uses a global *sciter.Sciter instance against the Low-Level API. Names of procedures and macros always begins with Sciter to follow naming conventions what is commonly used for bindings in other languages, e.g. help with handling string lengths for the correct character encoding. The Low-Level API to be more ergonomic for PureBasic usage, e.g.


Located in src/sciter.pbi, consist of procedures and macros that wraps the Low-Level API, goal is to adapt Bindingsīindings consist of two different parts, a High-Level API and a Low-Level API. If Not SciterLoadFile(*sciterHandle, "example.html")Įxample.js will be loaded synchronously but example.svg will be loaded asynchronously. If Not SciterDataReady(*sciterHandle,, *buffer, bytes)ĭebug "Failed synchronously loading resource " + uri Protected bytes = FileReadAllToBuffer(path, bytes <= 0 naive way by creating a new thread for each resource, thread pooling is probably preferable *asyncFile\requestId = *loadData\requestId Protected *asyncFile.AsyncFile = AllocateStructure(AsyncFile) If *loadData\dataType = #SCITER_RT_DATA_IMAGE resources can be loaded asynchronously (from another thread) or synchronously (blocking) Protected path.s = + (filePrefixLen * SizeOf(Character))) resources a prefixed with uri scheme, you can have your own schemes Protected filePrefixLen = Len(filePrefix) Protected *loadData.SciterScnLoadData = *pns
#Purebasic openwindow example code#
Procedure.C_UINT AppCallback(*pns.SciterCallbackNotification, *callbackParam)ĭebug "Callback happened with code " + *pns\code If Not SciterDataReadyAsync(*sciterHandle,, *buffer, bytes, *asyncFile\requestId)ĭebug "Failed asynchronously loading resource " + *asyncFile\uri Protected bytes = FileReadAllToBuffer(*asyncFile\path, bytes <= 0ĭebug "Error reading file " + *asyncFile\path Procedure AsyncLoader(*asyncFile.AsyncFile) Procedure.i FileReadAllToBuffer(path.s, *buffer.Integer)įile = ReadFile(#PB_Any, path, #PB_File_SharedRead) SciterValueStringDataSet(*retval, str, #Null)ĭefine "app", End expose HelloWorld() to JavaScript SciterValueStringData(*value, = PeekS(*buffer, len) Protected *value.SciterValue, *buffer, len.C_UINT, str.s Procedure InvokeHelloWorld(*tag, argc.C_UINT, *argv, *retval.SciterValue) Gtk_container_add_(*windowHandle, *widgetHandle)ĭefine *nsView = SciterCreateNSView(#Null)ĬompilerError "TODO attach to *windowHandle" Gtk_container_remove_(*windowHandle, *childHandle) GtkWindow already has a GtkBox attached, remove it ProcedureReturn = #PB_Window_SizeGadget |ĭefine window = OpenWindow(#PB_Any, 40, 40, 530, 580, "Sciter", #WINDOW_FLAGS)ĬompilerIf #PB_Compiler_OS = #PB_OS_Linuxĭefine *widgetHandle = SciterCreateWidget(#Null)ĭefine *childHandle = gtk_bin_get_child_(*windowHandle) Result = SciterProcND(hwnd, msg, wParam, lParam, handled Procedure WindowCallback(hwnd, msg, wParam, lParam) SciterSetupDebugOutput(#Null, #Null, #PB_Compiler_OS = #PB_OS_Windows Procedure DebugOutPut(*param, subsystem.C_UINT, severity.C_UINT, *text, text_length.C_UINT) Output any messages from sciter to Debug SciterSetOption(#Null, #SCITER_SET_DEBUG_MODE, #True)
#Purebasic openwindow example windows#
Attach to inspector, only works on Windows at the moment CompilerIf #PB_Compiler_OS = #PB_OS_WindowsĬompilerElseIf #PB_Compiler_OS = #PB_OS_LinuxĬompilerElseIf #PB_Compiler_OS = #PB_OS_MacOSĭebug "Failed loading Sciter dynamic library"
