Jump to content


  • Content Count

  • Joined

  • Last visited

  • Days Won


Posts posted by Czar

  1. Cheers Nico, the client app is as simple as I could make it. The creation app (not linked) has a bit more going for it. It is a bit rough but it is easy for my colleague to create new items with a minimum of fuss for franchisees to then customise and use for their social media requirements. It will save us many hours of work not having to customise on demand in Illustrator.


    I am in no way a fan of Edge - it is just that my years of educating our franchisees in using a real browser haven't paid 100% dividends. I will check out the links. I have insufficient understanding of javascript and find interfacing with SMS mostly hocus pocus. I will see how I get on tomorrow - as for now I am back to painting architraves and window sills :(

  2. This app is now almost done


    However, it won't download the resulting image in MS Edge :(

        writeln('About to create image for downloading');
        TW3URLObject.Download( LEncodedData, textbox[0].imagefilename);   // only works in a external browser
        writeln('encoded '+LEncodedData);

    The  LENcodedData is there but no image is created when TW3URLObject.Download is called. Works no probs with Chrome and Firefox


    Any ideas why edge is different and if there is possible to work around?


    I have attached simple example


  3. The source is all external - I was simply trying to add a unit/form to my project - easy to add a unit but the form won't open.

    I did a work around - create new unit of same name - save and then copy the .pas and .smf over the newly created code 

  4. Sorry, my type Tr1 was supposed to be r1.

    I haven't tried your code yet - but the main problem I was trying to solve is that I have two records in the JSON and I need to retrieve them into two different variables.


    So if I put r1 and r2 (which are different record types) into single JSON how do I parse it back?

    If your code answer the question then please ignore I will have a play when I have a few quiet moments.

  5. I have a situation that I cannot figure out the answer to, yet I know it is probably straight forward.

    I can send off a JSON set with data - but I would like to know how can I parse it back into the two records?


    I don't follow how I can access the two records inside the data inside procedure HowDoIParseBack

    TMyRecord1 = record
      caption : string;
      x : integer;
    TMyRecord2 = record
      SomeText : string;
    r1 : TMyRecord1;
    r2 : TMyRecord1;
    Procedure SendJSONToServer;
     var MyJSON := JSON.stringify(r1);
     MyJSON := MyJSON +','+JSON.stringify(r2);
    Procedure HowDoIParseBack;
            var JSONStr:= fhttp.ResponseText;
             @r1 = JSON.parse(@JSONStr);


  6. The function 

    function TW3FontDetector.MeasureText(const FontName: string;   const FontSize: integer; const Text: string): TW3TextMetric;


    in SmartCL.Fonts.Detector; replace spaces with _ resulting in spaces being way over estimated. The problem is when trying to right justify the measured width is much larger than the space required to render the font. So you cannot right justify text.

    Replacing the _ with a ! gives a closer result but it is still a hack - is there a proper solution to calculating the width a given text?


    I have attached a simple project to demonstrate the issue.

    The two sentences are supposed to be right aligned, however, the extra spaces in the second line causes the width to be over estimated.




  7. I am posting this little sample as it solves a problem we had and maybe it will be useful for someone sometime. We are making simple (sic.) app to allow our franchisees to add their own details to base images.


    The images can be quite big and don't fit nicely on the screen so I needed a way to translate mouse clicks from the image. I ran into problems when the images didn't fit the aspect ratio of the image container and the fscontain was screwing with my coordinates. The solution was simple, as it often is. Simply change the dimensions of the image container to fit the aspect ratio of the image data.





  8. The users of this app I am trying to make have tendency to uploadf massive images 7000x4000 etc


    I can load the image but I would like to resize the actual image to a smaller size (i.e., less date)


        LBitmap := TBitmap.Create;
        LBitmap.Allocate(W3Image2.PixelWidth, w3image2.PixelHeight);
        LRect := TRect.Create(0, 0, LBitmap.width-1, LBitmap.Height-1);

    I have the whole image in w3image2 but I would like LBitmap to be much smaller but I cannot see any way to do this.


    Help towards a slution much appreciated

  9. Hmmm, I am missing something.


    Lines does not exist for memo (TW3Memo)

    Syntax Error: There is no accessible member with name "lines" [line: 46, column: 23, file: Form1]


    procedure TForm1.InitializeForm;
    var item : string;
      // this is a good place to initialize components
      for item in w3memo1.lines do


  10. Sorry, I tried getting your code to work but I haven't mage to I added W3C.HTML5,  but .src and .onload were still unknown


    I would like to get it going locally

    function mathjs: Variant; external 'mathjs';

      var FMathParser: THandle;


    But it appears mathsjs is no longer the function and it is unclear to me how to get functioning.


  11. Well that was unexpected


    That works  a treat. The FMathParser.eval('1.2 / (2.3 + 0.7)') works nicely


    the otherfunctions like 

    .simplify('2 * 3 * x', {x: 4}).toString()) // '24'

    Don't seem to be part of math.js and math.js file on the website doesn't want to work. But this will be very useful. 

  • Create New...