Jump to content

Browser as Remote Control


UliBru

Recommended Posts

Hi,

 

I'm new to uniGUI. It seems to be quite interesting for my application.

So I have started a first test, running a simple trackbar on a form. I can move the trackbar both on the VCL application and also on the Firefox browser screen. So far ok at first sight. :)

 

Right now 2 questions have come up:

1. The two trackbars are not sync'd. How to achieve this, independent if the trackbar on the main VCL screen or on the browser screen is moved?

2. My VCL application has a lot of components. It is not necessary and desired to show them all in the browser. So in my understanding I would like to have a standard VCL form running on the PC and another second simple uniGUI form with few selected components. The PC user shall not see the uniGUI form (just invisible?) and the browser user just shall use the reduced form like a remote control. Of course sync'ing is required. Is this possible and how to achieve it?

 

Regards

Uli

Link to comment
Share on other sites

1. The two trackbars are not sync'd. How to achieve this, independent if the trackbar on the main VCL screen or on the browser screen is moved?

 

All sessions (VCL-window and browser-window(s)) are separate threads. So, if you want so, you have to synchronize them:

 

http://forums.unigui.com/index.php?/topic/1947-session-manager/page__p__8581__hl__locklist__fromsearch__1&do=findComment&comment=8581

 

(or use IPC).

 

2nd problem: you can't (easy) send information from server to browser; so browser must ask the server: use a timer, long polling, websocket, or ...

 

2. My VCL application has a lot of components. It is not necessary and desired to show them all in the browser. So in my understanding I would like to have a standard VCL form running on the PC and another second simple uniGUI form with few selected components. The PC user shall not see the uniGUI form (just invisible?) and the browser user just shall use the reduced form like a remote control. Of course sync'ing is required. Is this possible and how to achieve it?

 

You could make 2 different Forms (or Frames) and create/show them alternatively:

 

if WebMode then
 "Create + Show web-Form"
else
 "Create + Show Desktop-Form";

Link to comment
Share on other sites

All sessions (VCL-window and browser-window(s)) are separate threads. So, if you want so, you have to synchronize them:

 

http://forums.unigui.com/index.php?/topic/1947-session-manager/page__p__8581__hl__locklist__fromsearch__1&do=findComment&comment=8581

 

(or use IPC).

 

2nd problem: you can't (easy) send information from server to browser; so browser must ask the server: use a timer, long polling, websocket, or ...

Ok.

Do you have a code snippet for a browser polling the server?

 

You could make 2 different Forms (or Frames) and create/show them alternatively:

 

if WebMode then
 "Create + Show web-Form"
else
 "Create + Show Desktop-Form";

I do not really understand. Because IMO 'if WebMode ... else ...' means switching between two forms.

I like still to have both PC and Browser running in parallel. So my main form is a VCL form as usual dispayed at the PC screen. In addition I like to create another form (uniGUI form) that is shown up on the browser. Actually now I have the uniGUI main form displayed in parallel at PC and at the browser.

Or do I have to run two applications at the PC, one is the intended program, the other one is just a server in background with the broswer GUI acting as remote control? And the two programs have to communicate then by IPC.

Link to comment
Share on other sites

Do you have a code snippet for a browser polling the server?

 

Easiest way is to use a TUniTimer and in "onTimer" change the components on the (web)form, if there was changes (in the vcl-thread). But this will produce traffic and processor usage if the timer interval is too short.

 

I do not really understand. Because IMO 'if WebMode ... else ...' means switching between two forms.

I like still to have both PC and Browser running in parallel. So my main form is a VCL form as usual dispayed at the PC screen. In addition I like to create another form (uniGUI form) that is shown up on the browser. Actually now I have the uniGUI main form displayed in parallel at PC and at the browser.

Or do I have to run two applications at the PC, one is the intended program, the other one is just a server in background with the broswer GUI acting as remote control? And the two programs have to communicate then by IPC.

 

The browser session is another thread. It works like two (or more, if more browsers use it at the same time) applications in one. If you use the same form in both, you have two different instances of this form. So you can also use two different forms.

 

Are you the same "UliBru" like here ?

Link to comment
Share on other sites

Easiest way is to use a TUniTimer and in "onTimer" change the components on the (web)form, if there was changes (in the vcl-thread). But this will produce traffic and processor usage if the timer interval is too short.

 

 

 

The browser session is another thread. It works like two (or more, if more browsers use it at the same time) applications in one. If you use the same form in both, you have two different instances of this form. So you can also use two different forms.

 

Are you the same "UliBru" like here ?

Yes, I'm the same "UliBru". Just on a search for a simple solution for a iPhone or Android remote control for my Delphi program (except VNC). :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...