Recent

Author Topic: sharing application GUI layout  (Read 2148 times)

fpc2pas

  • New Member
  • *
  • Posts: 34
sharing application GUI layout
« on: July 16, 2021, 05:24:11 am »
Hey folks

currently, I have a small project (client/server) built on Synapse. I want to add a kind of feature which is called (Team Server); means that other team members can log in to the server GUI application and see the same server GUI.and from there they can manage connected clients.

any suggestion?

Edson

  • Hero Member
  • *****
  • Posts: 1296
Re: sharing application GUI layout
« Reply #1 on: July 16, 2021, 03:57:12 pm »
I think I made some similar. Basically I designed:

- A data model in a database .
- A GUI view client, that can connect to the database (not only a database connection but a GUI representation of the model).

Then I put in a Server: The database model and a view (connected to local).
The clients have a view (remoted connected) so they could have the same GUI that the Server.

Moreover, as database accepted several clients connection you don't have to worry about the concurrence. Even you don't have to implement a special network protocol to manage several clients.
Lazarus 2.2.6 - FPC 3.2.2 - x86_64-win64 on Windows 10

fpc2pas

  • New Member
  • *
  • Posts: 34
Re: sharing application GUI layout
« Reply #2 on: July 16, 2021, 06:14:01 pm »
I think I made some similar. Basically I designed:

- A data model in a database .
- A GUI view client, that can connect to the database (not only a database connection but a GUI representation of the model).

Then I put in a Server: The database model and a view (connected to local).
The clients have a view (remoted connected) so they could have the same GUI that the Server.

Moreover, as database accepted several clients connection you don't have to worry about the concurrence. Even you don't have to implement a special network protocol to manage several clients.

thanks, do you mind sharing some examples or samples?

Edson

  • Hero Member
  • *****
  • Posts: 1296
Re: sharing application GUI layout
« Reply #3 on: July 16, 2021, 07:20:48 pm »
thanks, do you mind sharing some examples or samples?

Well, this is not something I can show in a few lines of code. I've a big project using several technologies including this functionality.

Basically, I have a class representing the model (What GUI shows), that can read or write to Database:

Code: Pascal  [Select][+][-]
  1.   TCibModel = class
  2.     //Properties of GUI
  3.     ...
  4.     procedure ReadFromDB();
  5.     procedure WriteToDB();
  6.   end;
  7.  

Any changes in the GUI (model) needs to be updated to Database.

Then the View class is a Frame, so it can contain visual controls and you can include it in a form (like part of the GUI), something like:


Code: Pascal  [Select][+][-]
  1.   TfraVista = class(TFrame)
  2.     ...
  3.     procedure ConnectToDB;
  4.     ...
  5.   end;

Changes in the GUI is easy to update to Database. Just send an UPDATE command.

The problem here is to update the Views (can be many) from changes in the model (DB). A simple solution is just polling with queries, but it could be a load to the DB is it's too frequently.
« Last Edit: July 16, 2021, 07:23:35 pm by Edson »
Lazarus 2.2.6 - FPC 3.2.2 - x86_64-win64 on Windows 10

 

TinyPortal © 2005-2018