Page 1 of 1

View HTML pages

Posted: Wednesday 18th November 2020 1:33pm
by BruceSteers
I need a html viewer.
I used the new gb.gui.webkit but then realised as this is new it won't work on anything but latest gambas.

So sod that , i need another way.
and i also cannot use the old QT webkit it needs to be gtk based.

is there any simple examples of how to make a html viewer?
Needs to be backward compatible with gambas 3.12

Cheers all.
Bruce

Re: View HTML pages

Posted: Saturday 21st November 2020 4:41pm
by BruceSteers
Best solution i've come up with so far is to have my GTK app copy a small gbs script file to temp dir.
the gbs script file is a small QT webview script stored in the .public folder that when my app converts the markdown text to html it saves the html file in the temp dir and the script loads it and monitors the file for changes or deletion with a timer.
It updates the html page on temp file modification and closes the window on it's deletion so i can control it from my app by changing/deleting the temp file.

I also tried with not a script file but making an actual gambas app but the script was much easier to edit and test where an exe needed recompiling, copying to folder etc. handy thing gambas scripting :)

you can see what i've done here.
https://gitlab.com/bsteers4/scripted/-/tree/old-gambas

the original (made on new gambas but not to compatible for all) version is for gtk.webview enabled gambas so only the latest but this one DOES embed the viewer as it's all gtk so it can.
https://gitlab.com/bsteers4/scripted/-/tree/master

Has anyone got an example of external form embedding?
Ie.
the script file can be very quickly converted to a gambas exe or class.
Can i get my app to load/embed the separate app into one of it's containers?

It's tricky because my app cannot use the separate viewers source code in any way, i have to use the compiled exe and embed it,
i can't add it to the app as it's got gb.gui.qt.webkit in it's definitions and it conflicts with the GTK apps components.

But i'm thinking create a panel in my app and import/embed the viewer into it, just clueless as to how.

Any other Ideas folks?
Much love :)

Re: View HTML pages

Posted: Sunday 22nd November 2020 6:00pm
by cogier
Why can't you use QT?

Re: View HTML pages

Posted: Sunday 22nd November 2020 6:01pm
by vuott
BruceSteers wrote:
Saturday 21st November 2020 4:41pm
Has anyone got an example of external form embedding?
...
Can i get my app to load/embed the separate app into one of it's containers?
So, do you want to embed the Form of a Gambas program into the Form of another Gambas program ?

Re: View HTML pages

Posted: Sunday 22nd November 2020 7:15pm
by BruceSteers
cogier wrote:
Sunday 22nd November 2020 6:00pm
Why can't you use QT?
My text editor.
Macros do not work on QT
The app needs to be gtk for macros to work but i added a markdown previewer using the gtk webview (in the new gambas version), it works great.
For the older gambas's though i need to use QT to get a webview afaik.

Re: View HTML pages

Posted: Sunday 22nd November 2020 7:19pm
by BruceSteers
vuott wrote:
Sunday 22nd November 2020 6:01pm
BruceSteers wrote:
Saturday 21st November 2020 4:41pm
Has anyone got an example of external form embedding?
...
Can i get my app to load/embed the separate app into one of it's containers?
So, do you want to embed the Form of a Gambas program into the Form of another Gambas program ?
Yes exactly that. just can't do it in the IDE as one has gtk inteface and the other gui-qt-webkit so IDE won't let me mix. ,
There was a Application.Embedder property that looked like it might do the trick but it's depreciated so i guessed there must be an alternative?

or am i wishing the impossible possible?
Thank you Vuott

Re: View HTML pages

Posted: Sunday 22nd November 2020 7:30pm
by vuott
Ok, in my opinion you have currently to use X11 external functions.

Take a look at this page, that I wrote, of the Italian forum wiki:

https://www.gambas-it.org/wiki/index.ph ... API_di_X11

Well, there are two codes: the first is a little code of gambas program that we want to embed, the second (that uses X11 external functions) will embed the window (the Form) of first little program.
...obviously you must first run the program you want to embed.

Re: View HTML pages

Posted: Sunday 22nd November 2020 7:45pm
by BruceSteers
vuott wrote:
Sunday 22nd November 2020 7:30pm
Ok, in my opinion you have currently to use X11 external functions.

Take a look at this page, that I wrote, of the Italian forum wiki:

https://www.gambas-it.org/wiki/index.ph ... API_di_X11

Well, there are two codes: the first is a little code of gambas program that we want to embed, the second (that uses X11 external functions) will embed the window (the Form) of first little program.
...obviously you must first run the program you want to embed.

fantastic, thank you very much Vuott I will see what i can accomplish with that :)