HTMLViewer - disable scrollbars

can the scrollbars be disabled (ie. not visible)
regardless of the size of the actual webpage, I wanted to show only [0,0,w,h] where I specify Width and Height
so basically just the upper left corner

Note : the actual webpage is not under my control, so changing the content is not an option

If you have access to modify HTML content, put <any_tag style="overflow-y: hidden"> or style="overflow: hidden".

Please read the question before attempting to answer… please… it saves a lot of anquish for all involved

You could change that via JavaScript, too.

I’ve a plugin to replace n JavaScript if that helps…

That’s what I mean, actually.
You can use htmlviewer1.ExecuteJavaScript and execute

document.body.style['overflow-y'] = 'hidden';

thanks, not that important an issue
I was just hoping to have my HTMLSnapshot control leave them out of the image

Will post more about that control later… Takes a snapshot of a provided URL without using an plugins, or declares

The javascript Asis posted works just fine. No need for plugin or declare.

HTMLViewer1.ExecuteJavaScript("document.body.style['overflow-y'] = 'hidden';")

if I put this

me.ExecuteJavaScript "document.body.style['overflow-y'] = 'hidden';"

in the DocumentComplete event, then I get a blank image
if I leave it out, I get a valid image, but with scrollbars

Try the second method here : https://stackoverflow.com/questions/242608/disable-browsers-vertical-and-horizontal-scrollbars

That’s, probably, caused by document is not ready (not rendered) yet. You need to figure out equivalent function of jQuery $(document).ready. There are few javascript functions that can be used.

You already know that DocumentComplete event is only about the html document is already downloaded. It takes few second to be rendered.

This forum just went strange and deleted stuff…

Anyways this seems to work… even if it contains an “evil” command

me.ExecuteJavaScript "document.body.style['overflow-y'] = 'hidden'; document.body.style['overflow-x'] = 'hidden';"
app.DoEvents

Since this is in the “DocumentComplete”… then there are no more events

So, you need to wait until it’s ready before trying to access any HTML DOM. That’s why we use $(document).ready on a HTML page.

Put that code on a function and call

xojo.Core.Timer.CallLater

on DocumentComplete event.

Asis… .I get it… the problem is there seems to be no EVENT to tell me that

This code works here on Linux.

DocumentComplete:

xojo.Core.Timer.CallLater(2000, WeakAddressOf DisableScrollbar)

DisableScrollbar:

HTMLViewer1.ExecuteJavaScript "document.body.style['overflow'] = 'hidden';"

CallLater makes no sense… that is what a timer does… is call something one or more times at a future time…
but this whole “new framework” paradighm is not well thought out in my opinion, but again thats MY opinion

A regular timer action works just fine

Sub DocumentComplete(URL as String) Handles DocumentComplete
  #Pragma unused URL
  //
  me.ExecuteJavaScript "document.body.style['overflow-y'] = 'hidden'; document.body.style['overflow-x'] = 'hidden';"
  timer1.Mode=timer.ModeSingle 
End Sub

Yes, it is. I really like it. We don’t need to add a timer control. 1 line of code, that’s it, very simple and useful.

CallLater is over 9000 times better than just using a timer :slight_smile:

Is there a video on this, has Xojo done one? Someone please find it and post it in here if there is one.