restgay.blogg.se

Purebasic openwindow
Purebasic openwindow






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 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)

purebasic openwindow

SciterSetupDebugOutput(#Null, #Null, #PB_Compiler_OS = #PB_OS_Windows

purebasic openwindow

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) Attach to inspector, only works on Windows at the moment "NSApplication sharedApplication"), "delegate")ĭefine DelegateClass.I = CocoaMessage(0, AppDelegate, "class")ĭefine NotificationCenter.I = CocoaMessage(0, 0,ĭefine Selector.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" PostEvent(#PB_Event_WindowResizeComplete, #WinID, 0)ĪddGadgetItem(0, -1, "Added line " + LineCount)ĭefine AppDelegate.I = CocoaMessage(0, CocoaMessage(0, 0, ProcedureC WindowCallback(Object.I, Selector.I, Notification.I) #PB_Event_WindowResizeComplete = #PB_Event_FirstCustomValue Selector = sel_registerName("Window0_ResizeDone:")ĬocoaMessage(0, notificationCenter, "removeObserver:", appDelegate, "name:$", "object:", #nil) Selector = sel_registerName("Window0_Resize:")Ĭlass_addMethod(delegateClass, selector, notificationCenter, "addObserver:", appDelegate, "selector:", selector, "name:$", "object:", WindowID(#wndid)) If OpenWindow(#wndid, 100, 200, 195, 260, "PureBasic Window", #PB_Window_SystemMenu | #PB_Window_SizeGadget) ProcedureC Window0_ResizeDone(obj, sel, notification)

purebasic openwindow

ResizeGadget(#gadget1, 10, 10, WindowWidth(#wndid) - 20, WindowHeight(#wndid) - 20) ProcedureC Window0_Resize(obj, sel, notification) Global delegateClass = CocoaMessage(0, appDelegate, "class")ĪddGadgetItem(#gadget1,-1,"Added line " + cnt) Global appDelegate = CocoaMessage(0, CocoaMessage(0, 0, "NSApplication sharedApplication"), "delegate") Global notificationCenter = CocoaMessage(0, 0, "NSNotificationCenter defaultCenter") Class_addMethod(class, selector, imp, types.p-ascii)








Purebasic openwindow