Are you tired to make a program in desktop mode and to do it again for use in web? So why don’t you do it only once, and use it in two ways?

The objective is to make a simple system (encapsulated in a component) to create Delphi programs which run both in desktop and in web mode.

I named “desktop program”, the application which runs in the “local” computer, as the “typical” windows form.

I named Web Form the “typical” form entry showed in the Web Navigator.

A GGG program, can be executed in both modes (Desktop/WEB), and it can interact the both modes. So you can see literally what the user is doing, response some on-line question, and much more...

Our solution is an automatic runtime translation tool between the desktop form and web form, and giving the web form responses to be processed by the Desktop form.

This 'Central' component has the basic functions, and there are some child components which identify each desktop component and specifically handle the render and response functions. The user can "extend" the set of child components by adding the own "translations" to specify not supported components.

The component is a "general tool" and it is winsock independent connection , so it is possible to use it in several environments (Indy, Synapse...) and it is possible to use it in other "majors" tools as IntraWeb, so you can add interactive services to the IntraWeb application.

GGG is indicated for little web application, with simple forms and controls.


Use case of GpGadGet

There is a lot of ways to use GGG and it has several “modes”.

1-“Shared” runs a unique form to be shared for all the users (including the desktop program user). It can be used, for example, for a little multi-chat system, vote options counter,…

2-“Web” runs different forms for different users in hidden desktop forms. (Each user session creates the new hidden forms, see Sample3). It is the “pure web” mode and it allows the creation of Web app by using the same technique to create a Desktop one. This can be very useful for new programmers with no experience in Web programming, or for more experimented programmers looking for a simple Desktop/Web interaction system to include in a more “complex” page.

3- “interactive” Runs different forms for different users in normal showed forms The WebMaster in desktop system, can see the form changes in all the open user forms, even interact with them: chat, help, closes the connection by closing the “desktop” form. It can be used in a “new generation” of “hybrid” programs (Desktop/WEB), which can integrate other elements of Gp library, as help desk, remote control, on-line demo system, and more…

The component can use both 'traditional POST' and 'ajax' mode to exchange the info posts, but of course JavaScript must be activated.


Of course, GpGadGet is not magic, so it is not applicable to all kind of desktop applications to have a www translation. Some desktop components doesn’t have “translation” to web mode, and other are still not supported.

The main use can be in forms with normal controls, and simple graphics. But it is not possible to translate all kind of controls that you have in a desktop program, some of them because no translation is possible or other because they are not done at the moment.

It hasn't got any support for MDI application and has not got primary support for dialog boxes.

For not supported components it is possible to be treated as an Image (so at least you can see the component image and at least respond to click events)

Not all kind of web services has a desktop version solution too, so you can not think about any kind of web programs (because it has to be possible to run it in desktop too). But you can use external templates to render the html page (so you can mix other things in your program), and it is possible to intercept the www calls to specify some www features that has no relevance in desktop.

The “interactive” mode is not possible in ISAPI Dll, because an ISAPI dll has not got desktop access (it runs as a non interactive service). But you can create a “web” application with hidden forms.
The only solution that I have (at the moment) is an ISAPI program that bridges the calls to other "interactive service" running the Gp application. (I have some prototype done)

sample1 : Convert it

I take the convert.pas sample unit (included in the Delphi examples directory), I just inherited a new form taking the TFormCovert parent and including the TGpGadget and TGpSocket components to the form and setting the property of the port to 82, and in the oncreate method I make active the socket and run the browser where you can see the web mode of the program.

Download the example program in, , and run the sample1.exe program, which is very simple and there is no need for any installation or settings.

The main form application is shared in the web access for all the users, but you can configure the component to have different hiden forms for each user session.(so each user can have the own app session).

The result is that you can run the app in the traditional form, but the app is "shared" in internet. So somebody can use the same app form. Of course it can be a problem in some kind of app, because each user can be interactive with another one(It is like two users with 2 mice in the same PC).


Sample 2: Voteme

Download for sample binary.

The sample2 is a little on-line vote system. It is a simple form with 3 buttons and an input, that refreshes the pie chart showing the vote result.

The result is not so “democratic” because one user can vote several times in “separate” sessions.

1) We need the way to check the user session to test if the vote is repited. It intrudes new concepts: User session, check http params request...

When a web user contacts with the GpServer a user session (TgpUser) is generated to remember some information from the user. Each user session has a key which identify this session and recorder in field of the HTTP call, or as cookies.

You have the TResponRequest class which is the context of the call (Information about the request and about the response). When a web event is generated, the system emulates the desktop event, the sender object of the call is the TResponRequest instance which generates the call. We can know a lot of things of the call with this object, for example the user session id which makes the request.

2) Illustrate the use of custom controls. The Tchart component, which is not primary supported by GGG, can be adopted easily by the WWW form.

3) It uses a little template to custom the web page result.


Sample 3: firstfact

It is a DB aware sample which translates the Delphi DbStandard components to www

The sample runs the www in not interactive mode, so each www user session has its own form. It illustrates the way to get the application running in desktop mode for the desktop user.

The name of GpGadGets is because it is perfect to do little gadgets for google directories, you can include the following link in the google ig directory .

In following samples I will try to explain other aspects of the components...

GpGadGets its a part of granprimo project.




TSpyceSpice = Class (Tspyce)


Provide automatic translation of delphi forms to web forms.

It's for quick web anable any old delphi forms, so you can extend your remote functions by reusing old code.


TSpyceSpice =class (Tspyce)

Provide automatic translation of delphi forms to web forms.

      It's for quick web anable any old delphi forms, so you can extend your remote functions by reusing old code.
  property nameFormActual_:string  
  property FormActive :Tform Form active for automatic translation to HTML code
  property verforms:boolean  
  property difx:integer  
  property dify:integer  
  property difw:integer  
  property difh:integer  
  property maxwmlElement : integer  
  property absoluta:boolean  
  property Template:TstringList;  
  property nametemplate:string;  
  property fmaximowml:integer;  
  property onlyvisibles :boolean  


TSpyceSpiceWap =class (TspyceSpice) same than TspyceSpice for wap devices


spice Classes


Class Description
Field Description
fform (+)  
fnameFormActual (+)  
listashow (+)  
onlyvisibles (+)  
Method Description
actionspice (+) #No TAG found in source code#
doform (+) #No TAG found in source code#
getformActive (+) #No TAG found in source code#
LogAccion (+) #No TAG found in source code#
renderform (+) #No TAG found in source code#
Class Description


class (Tcomponent)

Encapsulate the HTML representation of a standart delphi wincontrol to generate automatics HTML form from any standart delphi form












Teléfono: 978-610539 - Fax: 978-610861 -Trav.Agustina Aragón 1,1e 44002 Teruel ( España ).webmaster

Copyright © 1997-2004 , [Multi-Informatica Teruel, S.L].La información contenida en este documento está sujeta a modificaciones sin previo aviso. Otros productos u organizaciones mencionadas aquí son marcas comerciales o marcas registradas propiedad de sus respectivas organizaciones o propietarios.