1. LazGUI

I have uploaded on RDS site a proof of concept showing how to build a multi-platform GUI server with CodeTyphon/Lazarus. Source code provided (OE and Lazarus). I will try to enhance it to get a complete GUI.

Some features need to be discussed:

  • should event notifications be pushed or pulled?
  • which syntax for commands and answers ?
  • which parameters needed ?
  • and so on

Jean-Marc

new topic     » topic index » view message » categorize

2. Re: LazGUI

jmduro said...

Some features need to be discussed:

  • which parameters needed ?

I answer myself. lazGUI server createButton routine can be easily converted to a generic routine createWidget that takes a list of parameters with name and value, so it can address the whole set of Lazarus widgets with a single routine. Every parameter name must have the exact name of the corresponding Lazarus widget property.

With a set of 3 simple methods, alls the GUI creation can be done: create_widget, modify_widget, destroy widget. This can be done by sending a sequence to the server in the following form

  • main_tag name
    • parameter value
    • parameter value
    • and so on
  • end_tag

where main_tag is create, modify or destroy, name is a class name for create and and instance name for modify or destroy (example: create TButton, modify btnOK, destroy btnOK). The sequence can be an XML sequence or whatever structured sequence.

All the help is already available in Lazarus documentation.

Widget names, defined by the server, shoud be built as Lazarus does: <classname><increment> (example: button1) and on the Euphoria client side there could be a correspondence table with more representative names (example: btnOK = Button1).

The Euphoria client could either listen on another TCP connection for event notifications or ask the server for notifications, or even both.

The driven GUI is a completely autonomous application, so functions to react on events should stay on the client side when not implicit reactions. Example: to show an info bullet when going over a widget, you just need to set the Hint parameter of the widget. Everything is done implicitly by Lazarus. But if you click on the widget, the client will get a notification and will have to react to update the serveur GUI if necessary.

The server can be built with whatever RAD that allows to dynamically create widgets but its widgets should be organized as classes, with properties. So instead of CodeTyphon/Lazarus, you could build it the same way with RealBasic, Gambas or some C++-based RAD.

Jean-Marc

new topic     » goto parent     » topic index » view message » categorize

3. Re: LazGUI

jmduro said...

I have uploaded on RDS site a proof of concept showing how to build a multi-platform GUI server with CodeTyphon/Lazarus. Source code provided (OE and Lazarus). I will try to enhance it to get a complete GUI.

Some features need to be discussed:

  • should event notifications be pushed or pulled?
  • which syntax for commands and answers ?
  • which parameters needed ?
  • and so on

Jean-Marc

I successfully ran your demo program.

How is lazGUI going to work for an actual application? Can a server and client exist inside a single Euphoria application? How do you get multiple applications running at the same time?

( laz comes out as "lazy", does that make for a good or bad name? )

Nice work

_tom

new topic     » goto parent     » topic index » view message » categorize

4. Re: LazGUI

_tom said...

I successfully ran your demo program.

How is lazGUI going to work for an actual application? Can a server and client exist inside a single Euphoria application? How do you get multiple applications running at the same time?

( laz comes out as "lazy", does that make for a good or bad name? )

Nice work

_tom

Thank you, Tom. A lazy programmer is an efficient one smile

Both client an server can be packed in one archive. The OE client will launch the server to let the GUI appear. Actually, the listening port of the server is fixed. If you want multiple applications to run simultaneously, than each GUI server must have a different listening port.This could be provided as a parameter on the server launch.

I have to deal with RTTI (RunTimeTypeInfo) to build generic routines that can handle many classes of widgets: this is new to me. There lies the problem.

Client and server will exchange XML structured sequences to create or update widgets or to send event notifications.

Jean-Marc

new topic     » goto parent     » topic index » view message » categorize

5. Re: LazGUI

I have uploaded a new version. Now a component is created by sending a JSON description to the server with any additional property (not method): integer, string or boolean up to now.

  object data = send_command(socketT, 
      "{\"create\":{" & 
        "\"class\":\"TButton\"," & 
        "\"Left\":10," & 
        "\"Top\":20," & 
        "\"Width\":80," & 
        "\"Height\":25," & 
        "\"Caption\":\"OK\"," & 
        "\"Visible\":true}" & 
      "}" 
  ) 

It shows only a button for now because component creation and naming is the only part of the Lazarus code that is not generic, but as you can see below, it is really not complicated to add more widgets.

    if widget_class = 'TButton' then begin 
      Form1.ControlList.Add (TButton.Create(Form1)); 
      TWinControl(Form1.ControlList[Form1.ControlList.Count-1]).Name := 'Button'+IntToStr(Form1.ControlList.Count); 
    end; 

Yet events are logged in a file. Next step is to send them to the Euphoria client via Telnet.

Jean-Marc

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu