WebUI wrapper

Share your advanced PureBasic knowledge/code with the community.
User avatar
jacdelad
Addict
Addict
Posts: 1992
Joined: Wed Feb 03, 2021 12:46 pm
Location: Riesa

Re: WebUI wrapper

Post by jacdelad »

Ok, I seem to be the only one with this problem: "File not found: 'webui-2-x64.lib'"
Do I need to install a specific browser?
Good morning, that's a nice tnetennba!

PureBasic 6.21/Windows 11 x64/Ryzen 7900X/32GB RAM/3TB SSD
Synology DS1821+/DX517, 130.9TB+50.8TB+2TB SSD
infratec
Always Here
Always Here
Posts: 7577
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: WebUI wrapper

Post by infratec »

Fred wrote: Mon Jun 12, 2023 10:47 am What do you mean by website ? You control all the UI as you are the only one to create it or I miss something ?
The website is dynamically. It fits the window.
Maybe you use a complete javascript editor and simply start the index.html file without modifications.

I would like to setup the window before.

But the developer already want to add this.

@dige
WebUI is primary for own UserInterfaces build in html and javascript.
You can try to build an own file with iframe inside, but most websites don't allow this anymore.
To avoid 'hijacking'
infratec
Always Here
Always Here
Posts: 7577
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: WebUI wrapper

Post by infratec »

@jacdelad
You have to download WebUI :wink:
Inside are the libs.
dige
Addict
Addict
Posts: 1391
Joined: Wed Apr 30, 2003 8:15 am
Location: Germany
Contact:

Re: WebUI wrapper

Post by dige »

infratec wrote: Mon Jun 12, 2023 1:40 pm @dige
WebUI is primary for own UserInterfaces build in html and javascript.
You can try to build an own file with iframe inside, but most websites don't allow this anymore.
To avoid 'hijacking'
Thank you infratec!

I've created a file 'ui\MainWindow.html' - it works! Fun fact: Webui always takes the browser I last used. I happened to have tested it after Firefox and Brave (Chrome) respectively.

Code: Select all

<!DOCTYPE html>
<html>
<head>
    <title>WhatsMyBrowser.org</title>
    <style>
        body, html {
            margin: 0;
            padding: 0;
            height: 100%;
            overflow: hidden;
        }
        
        iframe {
            width: 100%;
            height: 100%;
            border: none;
        }
    </style>
</head>
<body>
    <iframe src="https://www.whatsmybrowser.org" title="WhatsMyBrowser"></iframe>
</body>
</html>
"Daddy, I'll run faster, then it is not so far..."
nicolaus
Enthusiast
Enthusiast
Posts: 456
Joined: Tue Aug 05, 2003 11:30 pm
Contact:

Re: WebUI wrapper

Post by nicolaus »

Very nice, thank you.
How to show it direct in a browser (for example Chrome) without a extra own window?
Seymour Clufley
Addict
Addict
Posts: 1264
Joined: Wed Feb 28, 2007 9:13 am
Location: London

Re: WebUI wrapper

Post by Seymour Clufley »

The WebUI binaries don't seem to be available. Does anyone have the Windows zip?
JACK WEBB: "Coding in C is like sculpting a statue using only sandpaper. You can do it, but the result wouldn't be any better. So why bother? Just use the right tools and get the job done."
User avatar
Shardik
Addict
Addict
Posts: 2058
Joined: Thu Apr 21, 2005 2:38 pm
Location: Germany

Re: WebUI wrapper

Post by Shardik »

Seymour Clufley wrote: Mon Jul 24, 2023 8:42 pm The WebUI binaries don't seem to be available. Does anyone have the Windows zip?
You may download compiled binaries for Windows x64 from this official link of the stable version.
Seymour Clufley
Addict
Addict
Posts: 1264
Joined: Wed Feb 28, 2007 9:13 am
Location: London

Re: WebUI wrapper

Post by Seymour Clufley »

Shardik wrote: Mon Jul 24, 2023 8:55 pm
Seymour Clufley wrote: Mon Jul 24, 2023 8:42 pm The WebUI binaries don't seem to be available. Does anyone have the Windows zip?
You may download compiled binaries for Windows x64 from this official link of the stable version.
Thank you.
JACK WEBB: "Coding in C is like sculpting a statue using only sandpaper. You can do it, but the result wouldn't be any better. So why bother? Just use the right tools and get the job done."
Seymour Clufley
Addict
Addict
Posts: 1264
Joined: Wed Feb 28, 2007 9:13 am
Location: London

Re: WebUI wrapper

Post by Seymour Clufley »

Would there be any way to hide the WebUI window?
JACK WEBB: "Coding in C is like sculpting a statue using only sandpaper. You can do it, but the result wouldn't be any better. So why bother? Just use the right tools and get the job done."
User avatar
skywalk
Addict
Addict
Posts: 4211
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: WebUI wrapper

Post by skywalk »

jacdelad wrote: Mon Jun 12, 2023 1:35 pm Ok, I seem to be the only one with this problem: "File not found: 'webui-2-x64.lib'"
Do I need to install a specific browser?
I had a similar problem until I put "webui-2-x64.dll" in my dev folder.
I thought it would work with the static lib alone?
PB v603b3 CBE wrote:---------------------------
PureBasic_Compilation0.exe - System Error
---------------------------
The code execution cannot proceed because webui-2-x64.dll was not found. Reinstalling the program may fix this problem.
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
swhite
Enthusiast
Enthusiast
Posts: 789
Joined: Thu May 21, 2009 6:56 pm

Re: WebUI wrapper

Post by swhite »

Hi

I downloaded and tested your example and it works well. I then tried to create a web page in VS Code and saved the file but when I use window_show(my_window , "htm\myfile.html") the windows shows my html but Purebasic exists a few seconds later instead of waiting. The documentation says to add: <script src="/webui.js"></script> to your html files but I cannot find webui.js and wondered if that is why Purebasic is not working with my html page.

Any suggestions would be appreciated.

Simon
infratec wrote: Mon Jun 12, 2023 1:41 pm @jacdelad
You have to download WebUI :wink:
Inside are the libs.
Simon White
dCipher Computing
swhite
Enthusiast
Enthusiast
Posts: 789
Joined: Thu May 21, 2009 6:56 pm

Re: WebUI wrapper

Post by swhite »

Hi

It turns out that the project has moved to using TypeScript so webui.js is now webui.ts. However, I found that rather than using :

Code: Select all

  webui_show(window,"htm\dCFusnTCPG.htm")
I can use the following and everything works correctly.

Code: Select all

If ReadFile(0,"htm\dCFusnTCPG.htm")
   lcHtm = ReadString(0,#PB_Ascii | #PB_File_IgnoreEOL)
   CloseFile(0)
Else
   lcHTM = ~"<!DOCTYPE html><html lang=\"en\"><head><title>Error</title></head><body>Unable to load file></body></html>"
EndIf   
webui_show(window, lcHtm)
Simon White
dCipher Computing
AndyMK
Enthusiast
Enthusiast
Posts: 582
Joined: Wed Jul 12, 2006 4:38 pm
Location: UK

Re: WebUI wrapper

Post by AndyMK »

This is actually very nice. Thanks. I assume we can build GUI's in Spiderbasic and use them in PB?
himogec152
New User
New User
Posts: 4
Joined: Fri Aug 25, 2023 10:29 pm

Re: WebUI wrapper

Post by himogec152 »

The repo for PureBasic-WebUI is here: https://github.com/webui-dev/purebasic-webui
I found the link to this forum in the readme file. However, the repo is not working, somebody needs to finish it...
I tested the Python one and it's working fine.
himogec152
New User
New User
Posts: 4
Joined: Fri Aug 25, 2023 10:29 pm

Re: WebUI wrapper

Post by himogec152 »

By looking at Python examples (https://github.com/webui-dev/python-web ... -editor/ui) I noticed that webui.js file does not need to exist locally, it is a virtual file so.
Post Reply