"SetGadgetItemText" does not work with WebViewGadget on Windows 7.
A message always appears that the gadget is not initialized.
It would be nice to use inline HTML code on Windows 7 too ...
Editable inline HTML-Code on Windows 7
Editable inline HTML-Code on Windows 7
Last edited by flashbob on Tue May 14, 2024 6:08 pm, edited 1 time in total.
Re: Inline HTML Code on Windows 7
On Windows, the WebViewGadget depends on the WebView2 runtime being present.
All Windows 11 installations will have this, as will most (up-to-date) Windows 10 installations.
If you're distributing an app targeting Windows versions older than 11, it's safest to run the WebView2 installer as part of your app's own installation process, to ensure presence of this required component.
Please note: Microsoft has discontinued WebView2 support for Windows 7/8/8.1 following WebView2 v109. The Evergreen Bootstrapper should handle this at present, and simply download the appropriate older version on these operating systems, but that support may be subject to change in the future.
All Windows 11 installations will have this, as will most (up-to-date) Windows 10 installations.
If you're distributing an app targeting Windows versions older than 11, it's safest to run the WebView2 installer as part of your app's own installation process, to ensure presence of this required component.
Please note: Microsoft has discontinued WebView2 support for Windows 7/8/8.1 following WebView2 v109. The Evergreen Bootstrapper should handle this at present, and simply download the appropriate older version on these operating systems, but that support may be subject to change in the future.
Re: Inline HTML Code on Windows 7
Thanks for the info. I know about the new Windows versions ...
It would have been nice if I didn't have to specify a URL using the old "WebGadget" command, but could stream an inline code..
It would have been nice if I didn't have to specify a URL using the old "WebGadget" command, but could stream an inline code..
Re: Inline HTML Code on Windows 7
For Windows and the old IE-based WebGadget, you should definitely be able to set HTML via simple string using SetGadgetItemText, e.g.:flashbob wrote: Sat May 11, 2024 5:23 pm It would have been nice if I didn't have to specify a URL using the old "WebGadget" command, but could stream an inline code..
Code: Select all
OpenWindow(0, 0, 0, 400, 300, "Inline HTML", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
WebGadget(0, 0, 0, 400, 300, "")
SetGadgetItemText(0, #PB_Web_HtmlCode, "<html><body>Hello World (from inline HTML)</body></html>")
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
Re: Inline HTML Code on Windows 7
Thx for your reply and the sample. You're right. Sample is working. In this case it would be possible, for example, to display an HTML-based email. That would help me for now - I think.
The next step would be an editor that can also be used to create HTML text including formatting (e.g. in response to an email). I know, I'm hoping for too much and I'm spoiled by other programming languages ;-)
The next step would be an editor that can also be used to create HTML text including formatting (e.g. in response to an email). I know, I'm hoping for too much and I'm spoiled by other programming languages ;-)
Re: Inline HTML Code on Windows 7
The easiest approach, IMO, would be to ship the WebView2 runtime alongside your app on Windows, so you can escape from Internet Explorer compatibility woes.flashbob wrote: Sat May 11, 2024 5:48 pm The next step would be an editor that can also be used to create HTML text including formatting (e.g. in response to an email). I know, I'm hoping for too much and I'm spoiled by other programming languages ;-)
Then you could relatively simply embed something like Quill or CKEditor with good cross-platform consistency and pretty much any feature you might want here. Reinventing the wheel would be a major pain, especially when you start to go past basic features (and need to add things like accessibility, IME, BiDi, image, table, etc. support).
If you really wanted to reinvent things while using the IE-based gadget, looking into the contenteditable element attribute may be a good start, e.g.:
Code: Select all
OpenWindow(0, 0, 0, 400, 300, "Inline HTML", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
WebGadget(0, 0, 0, 400, 300, "")
SetGadgetItemText(0, #PB_Web_HtmlCode, "<html><body><div contenteditable>Hello World (from inline HTML)</div></body></html>")
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
Re: Inline HTML Code on Windows 7
The problem is, that i cannot read the changed html-code if I add some text.
EDIT:
I solved the problem (workaround) using Windows/MAC-API.
See example https://www.purebasic.fr/english/viewtopic.php?t=84271
EDIT:
I solved the problem (workaround) using Windows/MAC-API.
See example https://www.purebasic.fr/english/viewtopic.php?t=84271
Last edited by flashbob on Thu May 16, 2024 11:02 am, edited 1 time in total.