Htmlviewer in a new window

I have a window1 with texfield1, containing a local index.html file.
Now I want to open a window2 with a htmlviewer opening textfield1. How can I do that?.

Have a look at http://docs.xojo.com/DesktopHTMLViewer.LoadPage

I did, but the shown code gives me errors.

I takeit you’ve created Window1 and Window2 in the IDE, and given the first one some html in a TextArea, and the second an htmlviewer?

Then add a button to to window1, and in its Pressed event add something like:

Window2.show ()
window2.LoadPage (window1.mytextarea.text)

IIRC this does not work on Windows, so you’ll have to do something different there.

I now get the error Window1.PushButton4.Open, line 2
Type “Window2.Window2” has no member named “Loadpage”
window2.Loadpage (window1.textfield2)

Place an HTMLViewer on Window2, then call Window2.HTMLViewerName.LoadPage()

Yeah sorry, forgot to add that bit.

Still not working
Window1.Button1.Pressed, line 2
There is more than one method with this name but this does not match any of the available signatures.
window2.htmlviewer1.LoadPage (window1.textfield1.text)

Try:
window2.htmlviewer1.LoadPage (window1.textfield1.text, Nil)

Try the attached demo - just threw it together and know it works :slight_smile:
**Because Window2 is an implicit instance, you do not need to call window2.show. Since HTMLViewer is an object of an implicit window, it will automatically open the window when invoking the HTMLViewer.LoadPage method.

https://www.xojostudio.org/lb/HTMLViewer.xojo_binary_project

This works. Thanks

1 Like
Forum for Xojo Programming Language and IDE. Copyright © 2021 Xojo, Inc.