Git Product home page Git Product logo

Comments (21)

delphius avatar delphius commented on May 27, 2024 1

webui 7.zip please see attach lazarus project , it is not working no feedback

I see three main problems at first glance: 1. In Lazarus, you need to create a project of the "simple program" type; 2. In the project parameters, set the target processor family to x86_64, since the library webui.dll - 64 bit; 3. When installing the hook, the name is case sensitive, in your case it is myid and MyID, you need to bring them to the same denominator

from pascal-webui.

delphius avatar delphius commented on May 27, 2024 1

if you could share working example

First we need to update pascal wraper to the latest version of the library and only then write an example for Lazarus/Delphi based on it.

I'll take care of it.

from pascal-webui.

delphius avatar delphius commented on May 27, 2024 1

we need to update pascal wraper to the latest version of the library

updated the wrapper version to library version 2.4.0, I'll try to do an example on the weekend

thanks Delphius , we would like to ask you to add the sample if you are free

Lazarus Example

from pascal-webui.

hassandraga avatar hassandraga commented on May 27, 2024 1

Thank you @delphius for reporting this. Please open two issues. One for Yandex browser, and another for the headless mode.

About the pre-built libs, @ttytm implemented a nice CI to auto build and generate binaries when a new stable release tagged. For now, you should build the lib from source using any C99 compiler (No other dependencies are needed).

If you want to save time, this is my latest build in debug mode, so you can copy the logs from your terminal.
webui-2.zip

from pascal-webui.

AlbertShown avatar AlbertShown commented on May 27, 2024
program project1;
{$mode objfpc}{$H+} uses {$IFDEF UNIX} cthreads, {$ENDIF} Classes,WebUI,Dialogs,Interfaces { you can add units after this };
var window: size_t;
procedure EventHandler(e: Pwebui_event_t);
begin
    //writeln('Received callback: ', e^.data);
    ShowMessage('hello');
end;
begin
    window := webui_new_window; webui_show(window, '1.html');
    webui_bind(window, 'myid', @EventHandler);
    webui_wait;
end

from pascal-webui.

AlbertShown avatar AlbertShown commented on May 27, 2024

doesnt work

What error message do you see?

Can you use an example to see if it's working?

from pascal-webui.

alas82 avatar alas82 commented on May 27, 2024

no error message , it just nothing happen when i press the button

from pascal-webui.

AlbertShown avatar AlbertShown commented on May 27, 2024

No errors when you use your code, I see. And what about the example? Any errors?

from pascal-webui.

alas82 avatar alas82 commented on May 27, 2024

no , can you modify my code and show message/show dialog when you press a button

from pascal-webui.

AlbertShown avatar AlbertShown commented on May 27, 2024

You should use webui_bind() before webui_show().

program project1;

{$mode objfpc}{$H+} uses {$IFDEF UNIX} cthreads, {$ENDIF} Classes, WebUI, Dialogs, Interfaces { you can add units after this };

var window: size_t;

procedure EventHandler(e: Pwebui_event_t);
begin
    // writeln('Received callback: ', e^.data);
    ShowMessage('hello');
end;

begin
    window := webui_new_window;
    webui_bind(window, 'myid', @EventHandler);
    webui_show(window, '1.html');
    webui_wait;
end

from pascal-webui.

alas82 avatar alas82 commented on May 27, 2024

webui 7.zip
please see attach lazarus project , it is not working
no feedback

from pascal-webui.

alas82 avatar alas82 commented on May 27, 2024

webui 7.zip please see attach lazarus project , it is not working no feedback

I see three main problems at first glance: 1. In Lazarus, you need to create a project of the "simple program" type; 2. In the project parameters, set the target processor family to x86_64, since the library webui.dll - 64 bit; 3. When installing the hook, the name is case sensitive, in your case it is myid and MyID, you need to bring them to the same denominator

this all has been considered , but still not working , if you could share working example , ie press on the button showmessage
thanks

from pascal-webui.

delphius avatar delphius commented on May 27, 2024

we need to update pascal wraper to the latest version of the library

updated the wrapper version to library version 2.4.0, I'll try to do an example on the weekend

from pascal-webui.

alas82 avatar alas82 commented on May 27, 2024

we need to update pascal wraper to the latest version of the library

updated the wrapper version to library version 2.4.0, I'll try to do an example on the weekend

thanks Delphius , we would like to ask you to add the sample if you are free

from pascal-webui.

delphius avatar delphius commented on May 27, 2024

we need to update pascal wraper to the latest version of the library

updated the wrapper version to library version 2.4.0, I'll try to do an example on the weekend

thanks Delphius , we would like to ask you to add the sample if you are free

Lazarus Example

@hassandraga, I usually have a Yandex browser running, so webui selects it to launch the window, I looked at the mechanism in the source codes of the library. When testing a new version of the library, such a thing happens, if the Yandex browser is running, then webui_show simply opens windows Explorer in the folder C:\Users and that's it. If you unload Yandex, the library loads chrome by default and everything is ok. I haven't checked other browsers yet, there's no time.

if necessary, I can open the issue, but first I would like to understand if this is really a library error or something else.

And one more thing, pascal wrapper is already for 2.4.0, and in releases you can download dll only for 2.3.0. I downloaded 2.4.0 in the discussions and use the current dll in the examples, but I think not everyone will be able to figure it out, the main problem is that there is no backward compatibility for key structures, for example Pwebui_event_t, so it is very important to use the correct version of the binary library

And one more question, we use webui in headless mode to test pages from pascal, while in order to load the pages themselves, we have to use tricks such as this one:
webui_show(Window, '<!DOCTYPE html><html><head></head><body><script>function loadData(){fetch("linktosomehost.com").then(response=>response.text()).then(content=>{document.open("text/html");document.write(content);document.close()}).catch(error=>{console.error(error);});}window.onload=loadData;</script></body></html>');
to let webui to load the necessary library code on the browser side to serve events and websocket and it can be also done by dom manipulating.
I certainly understand the true purpose of the library, but since the possibility of working in headless mode has already been implemented, maybe we should think about a more efficient way of working in this mode?

from pascal-webui.

alas82 avatar alas82 commented on May 27, 2024

we need to update pascal wraper to the latest version of the library

updated the wrapper version to library version 2.4.0, I'll try to do an example on the weekend

thanks Delphius , we would like to ask you to add the sample if you are free

Lazarus Example

thanks delphius , could we use showmessage instead of writeln?

from pascal-webui.

delphius avatar delphius commented on May 27, 2024

thanks delphius , could we use showmessage instead of writeln?

these are just training examples, if the output goes to the console, then it is better to output to the console, otherwise you will have to pull the entire lcl behind you to connect dialogs

from pascal-webui.

alas82 avatar alas82 commented on May 27, 2024

thanks delphius , could we use showmessage instead of writeln?

these are just training examples, if the output goes to the console, then it is better to output to the console, otherwise you will have to pull the entire lcl behind you to connect dialogs

yes actually i had done that , but when i press it didnt show message

from pascal-webui.

delphius avatar delphius commented on May 27, 2024

yes actually i had done that , but when i press it didnt show message

wouldn't it be easier then to use the usual lazarus form instead of the console?

from pascal-webui.

alas82 avatar alas82 commented on May 27, 2024

yes actually i had done that , but when i press it didnt show message

wouldn't it be easier then to use the usual lazarus form instead of the console?

the idea is to mix the beauty of HTML5 & CSS and the power of fpc and lcl , like using printers , reports , dialogs ....etc

from pascal-webui.

fibodevy avatar fibodevy commented on May 27, 2024

Im closing this as everything is working. Sample project provided is invalid, element IDs are case sensitive.

from pascal-webui.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.