Jump to content

Harry Rogers

uniGUI Subscriber
  • Posts

    237
  • Joined

  • Last visited

  • Days Won

    6

Posts posted by Harry Rogers

  1. So if I understand you  - rather than add EXIF data to an image file you wish to draw on its canvas? That's a fairly straightforward Delphi task

    If for example you have your starting image data in a Tpngimage (e.g. named PNGImage)

     you just need to set up a brush and font for the canvas and write your text to it

    ....

        PNGImage.Canvas.Brush.Style := bsClear;
        PNGImage.Canvas.Font.Size := 16;
        PNGImage.Canvas.Font.Color := clRed;
        PNGImage.Canvas.Font.Style := [fsBold];
        PNGImage.Canvas.TextOut(5, 5, datetimetostr(now) +  '  '  + SomeEditControl.text);
     
        PNGImage.SaveToFile('changed.png');

     '''''  

    Before                                                                                After

    image.png.a04dc9b2d5c8b41e55ffa43933be76a1.png

     

     

    • Like 1
  2. UPDATE:  Resolution - [well good enough anyway] - I'm sure it creates plenty of back and forth traffic - if anyone knows a better way then please dive in!

    If the Websocket is used to update the text value of a UniEdit rather than a unilabel.caption then the Onchange event of that edit is fired and the uniedit.text  value is the new value sent by the websocket.

    (N.B you need to use setValue from js to write the text field of a uniedit. )

    ( I tried with a dynamically created on change event for the label (as per the demo example dyn.dproj) but that never fired from the websocket update  - only manual changes)

    So on the Client side we how have this js event

    function form.socketmessage(sender, msg, params, eOpts)
    {
       if (msg == 'update') {
         // MainForm.UniLabel1.setText(params.value);   << never updates the underlying value only the rendered one.
         MainForm.UniEdit1.setValue(params.value);    // Works fine
       }
    }

    Then use the standard Delphi/Unigui Onchange event of the UniEdit to get at the new value.

    • Thanks 1
  3. I too have this question. The example does not seem to answer it - I think.

    E.G. 

    the Server module uses a websocket to update a client side unilabel caption, for example with a variable calculated in the server module ("filename"), like this

    ........

    if PersistentNode then
        BroadcastMessage('update',
                                 [
                                   'value', filename
                                 ],
                     [boClientOnly]);

    ....................

    In the client main  we use the  clientevents to grab that message and update the label caption

    function form.socketmessage(sender, msg, params, eOpts)
    {
       if (msg == 'update') {
          MainForm.UniLabel1.setText(params.value);
       }
    }

     

    Visually the label does indeed update the caption to show the current value of "filename".

    HOWEVER

          on the client side

    showmessage(unilabel1.caption);    Shows the pre-existing caption NOT the updated text sent from the websocket.

     

    What's the mechanism to update the internal representation of label.caption to match what's actually displayed?

  4. All our work is done server side - so it's just pretty standard Delphi stuff, no Javscript etc required. 

    In one application we have tablets out in the field returning HTML data to the server. When the UNIGUI user browses the list of returned files we check to see if the same file name exists but with a PDF extension rather than HTM - if not we simply call wkhtmltopdf.exe from a procedure in mainmodule in a hidden window  with param1 as source html and param2 as the required PDF. Once the PDF does exist we display/print as required.

    you could use any Delphi function that runs an external exe (ShellExecute, ShellExecureEx, WinExec, CreateProcess....) 

    This approach works fine for us, it's easy to implement and allows additional processing if the called process is actually a batch file with a list of other things to do in it, rather than just converting to a PDF.

     

    Cheers

    • Like 1
  5. Hi

    We have used ICS components a lot over the years - and have been very pleased with them.  However we have found their architecture not well suited to Unigui.

    In our implementations we tend to use a VCL program to send emails which we call from the Unigui sessions as needed, with parameters supplied either via the command line or database tables  - there are other discussions and demos on the forum regarding email solutions.

    There is a thread from 2010 relating to ICS  -  Farshad's reply summed it up. Best of luck

    It seems that Overbyte components use Async TCP/IP communication which

    relies on Windows message events.

    This requires component to reside inside a thread which can receive Windows

    events. In unigui there are no such dedicated threads to sessions. Threads

    are created and controlled by the Web server and for sessions threads are

    only available during event execution. Moreover, it is not guaranteed that a

    session will be always served by same thread. It can thread A in first event

    and thread B in next event.

  6. I've been using Contabo vps for the past 4 months (4core 8GB,200GB). It's certainly the cheapest and performance has so far been fine - though not a heavy load. It's worth mentioning - they appear to do any required maintenance during normal (GMT) service hours - which has so far resulted in 2, 1 hour periods of inaccessibility - they do have multiple clusters of VPS  which are serviced at different times though - and if you have more than one you can request to have them housed on separate and machines and/or in two different data centres - so you can ensure constant accessibility if you share data and apps across them. All support questions have been answered promptly.  Note They don't provide any additional firewall in front of your machine as many other providers do.

  7. Sorry you misunderstand me. The main module holds the data set and the export component. the form 'frmSQLRes' has a button named 'btn2Excel' it's the onClick of that which is the code I showed above.

    Good luck

  8. Hi

    I have used SMExportToExcel [the components 'about' gives ver 5.0 (b17)]. without issue.

    I just recompiled an old app (was xe5) using Xe8 and UniGui 1.70.0.1485. It still exports fine.

    The form with a UniDbGrid (whose dataset is on the MainModule) has a button: It simply sets the filename (from a procedure that gets the query details) on a SMExporttoXLS component that is on the MainModule, and runs the export. 

     procedure TfrmSQLRes.btn2ExcelClick(Sender: TObject);
      var fname : string;
     begin
      fname := makeFilename('.XLS');
      unimainmodule.SMExportToXLS1.filename := fname;
      unimainmodule.SMExportToXLS1.Execute;
    end;

  9. This looks great - thanks for posting. On a Moto E4+ mobile (chrome 73.03683.75 Android 7.1.1) I never get a prompt to allow the camera and can't find a way to enable it, the site settings within the browser only provide the option to block camera or prompt for permission (which never happens)

  10. Thanks for the reply

    CurrPage = UniDBGrid1.DataSource.DataSet.RecNo div UniDBGrid1.WebOptions.PageSize + 1

    That was my initial thought 

    However my database returns the fixed natural order position with dataSet.Recno - not much use with filters and or indexes. I need currpage to enable the calculation of the 'effective  Recno' .

     

  11. Hi

    CurrRow returns the integer row number for the current page of  a UniDbGrid and weboptions.PageSize gives the number of rows per page. How do I read the current page ? - so I can construct a record counter display.

     

    Thanks

×
×
  • Create New...