Jump to content

SantoshGnostice

Members
  • Posts

    13
  • Joined

  • Last visited

Posts posted by SantoshGnostice

  1. I have found an example implementation in UniGUI that may suit what I am looking for. The method "uniGUIDialogs.Prompt" takes a callback function which is called from the client-side once the user dismisses the dialog. Is there something similar which we can use when developing a custom component? How is the the Delphi callback procedure linked to the client-side callback?

  2. A simple example of what I am looking for:

     

    Server-side:

    procedure CallBack(AResult: string);
    begin
      // Control comes here after timeout
    end;
    
    JSAsyncCall('method', CallBack);
    
    

    Client-side (JS):

    method: function(callback) {
      setTimeout(callback, 1000, 'result');
    }
    

    I could use ajax to achieve this but I'd have to maintain a mapping on the server of all the callback functions and call them appropriately when the message arrives from the client. I am sure UniGUI must have solved this problem already - so I was looking to see if the framework has something I can use to achieve this.

  3. I am looking for server side method which can invoke a JavaScript function that takes a callback and later asynchronously calls this callback which should result in a server-side call. Basically an async version of existing JSCall method which can take an anonymous function or a delphi callback. Is there such a method already present?

  4. BTW your suggestion and code prompted me to do a workaround for this. Now I am checking the iframe's "src" attribute and ignoring the first event.

    function frameload(sender, frame, eOpts)
    {
       // For some unknown reason (bug?) this event is called when the parent form loads and
       // the frame is still empty. So ignore it if the src is blank.
       var frameDivId = MainForm.UniURLFrame1.id;
       var frame = $('#' + frameDivId + ' iframe');
       var src = frame.attr('src');
       if (src === 'about:blank') {
          return;
       }
    
       // ...
    }
    
  5. Hi,

     

    If I understand you correctly, you can try to use OnFrameLoaded event on the server side instead of "function frameload",

    for example:

    procedure TMainForm.UniURLFrame1FrameLoaded(Sender: TObject);
    begin
      if (Sender as TUniURLFrame).URL<>'' then
        // your code
     
    end;
    

    Best regards,

    I need to run some JS in response to the frame load hence the reason for me to use the client-side event.

     

    I seem to be getting answers suggesting workarounds which I appreciate but unfortunately those won't work for my need. I believe the errant behavior is due to a bug either in UniGUI or in Ext JS.

  6. @mohammad my situation is a bit different. Let me try to explain with a simple example. I have a main form on which I have a button and a TUniURLFrame (which is basically an iframe element in HTML). When the user clicks the button I load another website inside the TUniURLFrame. I want to be notified when the iframe has finished loading the external website. For this I am trying to use the TUniURLFrame's ClientEvents -> ExtEvents -> frameload event which should fire after the external website is done loading completely inside the iframe. There is no other way for me to find out the completion of the load. This all works fine except for the issue where when my application main form is loaded the TUniURLFrame's frameload event is being fired though there is nothing for it to load (it's URL property is empty when the app starts).

  7. Hi

     

    I have a form with a frame inside which is initially empty and at a later point I set a URL to the frame to load a page. I need some JS to be run after the frame has loaded the page. For this I have setup a handler under ClientEvents -> ExtEvents -> frameload as shown below:

    function frameload(sender, frame, eOpts)
    {
       alert('Viewer loaded!');
    } 

    However I am finding that this event is fired twice. Once when the application is loaded. And again later when I set a URL to the frame and the frame is done loading the page. The second firing is fine but I don't understand why it's firing the first time when nothing is loaded in the frame.

     
    Apprecitiate the help!
  8. @Stefano, thank you for mentioning our products  :)

     

    It looks like linking the form fields to a dataset is a really popular need. We will take this feature up immediately and report back once it's implemented. Right now with StarDocs you can load a PDF form, fill it, save it back to the PDF, print it and "post" the form data to a URL. 

     

    Is there a way to do this with the "normal" components (e.g. not the StarDocs "in the cloud" service) or is it possible to host the server side that renders/serves the document yourself?   Not really sure I like the fact that documents have to be pushed/uploaded to Gnostice in order for this to work...  

     

    @wprins, StarDocs is available as two variants. One is hosted in the cloud and another is available as an on-premises server that you can host within your network. With on-premises server your documents are secure within your network. You can download a trial of the on-premises server here. This is available as a virtual appliance so it's easy to deploy without having to worry about OS, dependencies, etc. If you don't already have a virtualization platform (ex: VMWare) you can download the free VirtualBox to host the StarDocs virtual appliance.

×
×
  • Create New...