Jump to content

Is there a way to use a VCL component and send the rendered Canvas to the client?


eelias

Recommended Posts

I do understand how uniGUI works, however I was thinking about some cases where there just simple cool libraries like TMS where complementary components could be used. 

 

I was thinking on the component render its graphic to the canvas (as vcl does) and then somehow send the canvas (as a jpeg) to the client side. It could have a component that could facilitate that, so once the VCL component is done, canvas is updated, it get it and send to be displayed on the client side.

 

Of course the client side will only see a snapshot. But that is a lot better of not having ANYTHING!

 

In many cases for example, could be possible to use TMS GRID or DevExpress GRID and only get its snapshot. (it will looks like a report basically).

 

For other cases like TMS Diagram Studio, it could be nice to send the resulting diagram. On design time it will be created and used as plain delphi component. It will render the results normally and the snapshot when done sent.

 

Eventually it could be a container? Like a Panel that anything VCL that is placed inside will be rendered and sent when done or streamed like video (frames/second that could be defined since web could be slow) (i am pushing a little here)? 

 

That would open a door for the huge amount of components out there to have some presence on unGUI.

 

Eduardo

Link to comment
Share on other sites

hello eelias,

 

i am not sure if i understand you correctly - but:

 

Serverside:

the UniGui.dll with all the things ;-)  ...

For a spezial-report, i wrote a win32bit-standard-delphi-exe - nothing with UniGui  (the programm must be threadsave !!!!!!!!)

the program creates (with infos from startparameter) reports and safe the results in a subfolder of c:/apache/htdocs/.../ and closes itself..

 

Clientside:

the user clicks on a button in the browser - to start a procedure ..

the procedure starts the exe-file with parameters: filename ect.. (shellexecute..)

the uniGui.dll creates a uniURLFrame and a uniTimer

the uniTimer checks every second - if c:/apache/htdocs/.../filename exists

if the file is created by the Windows-exe - the "if fileexists-function" findes the file -> the uniHTMLFrame shows the file..

 

Is this a way you are looking for ?

 

hth

Erich

 

 

 

 

 

My Problem was the Execute - this works for me:

var reportname:String;
    reportparameter:String;
    reportnummer:Integer;


    SEInfo: TShellExecuteInfo;
    ExitCode: DWORD;
    ExecuteFile, ParamString, StartInString: string;
 begin


    reportnummer:=Random(99999999);
    reportname:=inttostr(reportnummer);
    reportparameter:='"'+inttostr(reportnummer)+'"';
    reportparameter:= reportparameter +unimainmodule.aktueller_exporttyp;


    ExecuteFile:=UniServerModule.TempFolderPath+'\vprint2.exe';


    FillChar(SEInfo, SizeOf(SEInfo), 0) ;
    SEInfo.cbSize := SizeOf(TShellExecuteInfo) ;
    with SEInfo do begin
      fMask := SEE_MASK_NOCLOSEPROCESS;
      Wnd := Application.Handle;
      lpFile := PChar(ExecuteFile) ;
      lpParameters := PChar(reportparameter) ;
   // lpDirectory := PChar(StartInString) ;
      nShow := SW_HIDE;
    end;
    ShellExecuteEx(@SEInfo);

 

 

the "timer based loop"    (aktueller_reporttyp = a String)

 

procedure Tform_print.UniTimer1Timer(Sender: TObject);
begin


    if fileexists(unimainmodule.aktueller_reportname)  then
    begin
    UniURLFrame1.URL:='/temp/'+unimainmodule.reportname_ohne_pfad;
    UniTimer1.Enabled:=false;
          if unimainmodule.aktueller_reporttyp <> '.pdf' then
          begin
            unipanel1.Caption:='..Document was created and was downloaded';
          end;


    if unimainmodule.aktueller_reporttyp = '.pdf' then UniPanel1.Visible:=false;
    if unimainmodule.aktueller_reporttyp = '.jpg' then UniPanel1.Visible:=false;


    end;


end;

 

 

Link to comment
Share on other sites

Erich,

 

Thanks on answering.

 

I believe I was not clear.

 

I am not looking for showing PDF at all...  I am looking to use any VCL component, like grids, like diagrams, etc, in a "passive" mode. 

 

Since unigui is based on extjs what we really see is the extjs. There is no real VCL control, they are only for design. That is fine!

 

However one of the good things about delphi is the huge amount of components. And we could get benefit of that if standard VCL could be rendered inside a special control, like a panel that you drop the component inside it. When it updates itself, this special panel takes a picture (snapshot) of the current canvas and send it as jpeg to a correspondent panel in the client side (unicanvas or uniimage)

 

Did you get the idea?

 

The problem is that I am not sure what is involved on let the standard control draw in canvas. It sounds simple, but could be a lot of trouble.

 

Eduardo

Link to comment
Share on other sites

There is already a library that does exactly what you describe http://forums.unigui.com/index.php?/topic/3487-ive-found-new-web-dev-frameworkwebfmx-how-do-you-think-about-it/

FMX only and very slow. I don't think this is a good idea unless all your users are on a local network.

 

I am speaking about uniGUI. I dont want to switch to any other framework.

Link to comment
Share on other sites

Beside being slow, VCL controls are not thread-safe. How you will achieve this when there are 100 sessions with many active requests in different threads? You'll also run out of GDI handles very soon when there are a few hundred sessions.

 

Thread-safe is a good reason. Speed I don't see a problem. However GDI handles its a problem. Thank you in let me know.

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...