View HTML pages

For questions about Gambas web tools.
Post Reply
User avatar
BruceSteers
Posts: 1505
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

View HTML pages

Post 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
If at first you don't succeed , try doing something differently.
BruceS
User avatar
BruceSteers
Posts: 1505
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: View HTML pages

Post 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 :)
If at first you don't succeed , try doing something differently.
BruceS
User avatar
cogier
Site Admin
Posts: 1117
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

Re: View HTML pages

Post by cogier »

Why can't you use QT?
vuott
Posts: 261
Joined: Wednesday 5th April 2017 6:07pm
Location: European Union

Re: View HTML pages

Post 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 ?
Europaeus sum !

Amare memorentes atque deflentes ad mortem silenter labimur.
User avatar
BruceSteers
Posts: 1505
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: View HTML pages

Post 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.
If at first you don't succeed , try doing something differently.
BruceS
User avatar
BruceSteers
Posts: 1505
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: View HTML pages

Post 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
If at first you don't succeed , try doing something differently.
BruceS
vuott
Posts: 261
Joined: Wednesday 5th April 2017 6:07pm
Location: European Union

Re: View HTML pages

Post 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.
Europaeus sum !

Amare memorentes atque deflentes ad mortem silenter labimur.
User avatar
BruceSteers
Posts: 1505
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: View HTML pages

Post 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 :)
If at first you don't succeed , try doing something differently.
BruceS
User avatar
BruceSteers
Posts: 1505
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: View HTML pages

Post by BruceSteers »

Talk about tricky.

I've sort of got it working . or at least if there were 10 steps involved i'd say it on step ,, 2 maybe lol
All i have managed to accomplish is a window that attaches itself inside the other app but doesn't use the position 0,0 supplied.
Doesn't seem to be connected to anything but the top window (does not move with resize but moves with the window)

i can't find it looking for additional children in the main window to do anything with it :(
I couldn't attach it to any containers just Form1.Handle was the only ID i found to work.

Thanks for the help Vuott but i do not think I can use it unless i can place it better.

I've attached the test app i made.
could be a starting block for someone.
If at first you don't succeed , try doing something differently.
BruceS
User avatar
BruceSteers
Posts: 1505
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: View HTML pages

Post by BruceSteers »

Well i got this way at least.
Really not what i wanted but to be fair, the end result is kinda similar :)

In the linked video I first have open the version of the editor that is made with the latest gambas using gb.gui and the new gb.gui.webview.
Able to make a webview with both gtk and qt the app has the previewer all self contained in a panel.
I load a markdown doc and show it in use.

Then I close the editor and run the other version designed for older gambas without the gb.gui.webview but the qt webview.
(remember i don't want app to be qt only but still want a webview)

The other version does things differently.
It opens a separate app viewer (using QT regardless of editors gui) positioned relative to the open editor.
The viewer app opens a pipe file and waits for messages to be sent by the main editor that sends the pipe messages on form move and resize if the previewer is open. The previewer then responds.

(I demonstrated both editors in action in the vid to show how , meh yeah , kinda similar ;) )

If at first you don't succeed , try doing something differently.
BruceS
Post Reply