I’m using Xojo 2024 4.2 on Windows 11
I have a DesktopHTMLViewer and need to capture its contents to an image. I can figure it out using HTMLViewer, but not DesktopHTMLViewer
//This works for standard HTMLViewer
var capturedPicture As Picture = HTMLViewerPost.IEImageMBS
It gives this error if the Superclass is DesktopHTMLViewer:
Window1.Button2.Pressed, line 4
This method extends class HTMLViewer, but the base expression is class DesktopHTMLViewer.
var capturedPicture As Picture = HTMLViewerPost.IEImageMBS
Any tips?
Thanks, Bill
A standard HTMLViewer is using the old Internet Explorer engine by default. DesktopHTMLViewer is using Chromium. This is probably the reason for the difference in capture capabilities.
You might want to explore using WebView2ControlMBS instead of DesktopHTMLViewer with its CapturePreview method. It will also cut the Chromium runtime out of your framework and save you a few hundred megabytes in app size.
Edit: You also don’t get bundled chromium with the IE engine you’re already using. But WebView2 is a much more modern rendering engine and is definitely recommended over IE.
1 Like
This is a whole new learning curve, but your help has got me going! Figuring out how to use MBS is challenging me. Looking at this
when I have never used it makes my head spin! I’m finding Grok helpful, but hit my limit tonight.
Thanks Christian
1 Like
Well, how about you find the sample project and try it?
Or just drop a WebView2ControlMBS control on your window and try the methods?
Let me know if you have a question.
1 Like
After Christian Wheel’s tip, I did go right to work on it. I just changed the Superclass in my project and played with it there. I got it to do what I needed in the moment (zoom, capture an image). I’ll look at the example project to see what other nifty stuff there is.
I appreciate your plugins! I’m typically several hours into something not natively doing precisely what I need before I start researching MBS alternatives. Then boom, the plugin for it is exactly what I need. Figuring out how to use it (syntax, options) when I’m already burned out it is what makes my head spin!
What I need to do is invest a little time learning your documentation when my mind is fresh! I will say that Grok seems give me good MBS tips! Are there any AIs you recommend for MBS/Xojo code tips?
Thanks!