Again thanks to eddy

eddy's example has to be modified to work with Linux because in PureBasic's WebGadget the execution of JavaScript is possibly disabled. You have to insert the following code between "If CatchXML(#xml,.." and "SmartWindowRefresh(#win, #True)" in order to check whether script execution is disabled and to enable it if yes:Kukulkan wrote:But here on my Linux system, it does not trigger any event (but also no error messages).
Code: Select all
If CatchXML(#xml, @xml$, StringByteLength(xml$)) And XMLStatus(#xml)=#PB_XML_Success And CreateDialog(#dialog) And OpenXMLDialog(#dialog, #xml, "win")
CompilerIf #PB_Compiler_OS = #PB_OS_Linux
#G_TYPE_INT = 6 << 2
ImportC ""
g_object_get_property(*Object.GObject, PropertyName.P-UTF8, *PropertyValue)
EndImport
ImportC "-lwebkitgtk-3.0"
webkit_web_view_get_settings(*WebView)
webkit_web_view_set_settings(*WebView, *WebkitSettings)
EndImport
Define WebkitSettings.I = webkit_web_view_get_settings(GadgetID(#web))
Define Value.GValue
If WebkitSettings
Value\g_type = #G_TYPE_INT
g_object_get_property(WebkitSettings, "enable-scripts", @Value)
If g_value_get_int_(@Value) = 0
g_value_set_int_(@Value, 1)
g_object_set_property_(WebkitSettings, "enable-scripts", @Value)
webkit_web_view_set_settings(GadgetID(#web), WebkitSettings)
EndIf
EndIf
CompilerEndIf
SmartWindowRefresh(#win, #True)