Jump to content

TrevorS

Members
  • Content Count

    18
  • Joined

  • Last visited

Posts posted by TrevorS


  1. Type THelpModel = Class(TGridModel);
    
    procedure TViewPart.ChangeStringGridComboBoxCurrency(Sender: TObject);
    begin
      with TComboBox(Sender), StringGridPartDet 
       do begin
        THelpModel(StringGridPartDet.Columns[2].Model).DoSetValue(Col,Row, TValue.From<String>(Items[ItemIndex]) );
        StringGridPartDet.Columns[2].UpdateCell(Row);
       end;
    end;
    
    procedure TViewPart.StringGridPartDetCreateCustomEditor(Sender: TObject;
      const Column: TColumn; var Control: TStyledControl);
    begin
      if Column = StringGridPartDet.Columns[2] 
       then begin
         Control := TComboBox.Create(Self);
         TComboBox(Control).Items.AddStrings(['GBP', 'EUR']);
         With StringGridPartDet, TComboBox(Control) do
           ItemIndex := Items.IndexOf(THelpModel(StringGridPartDet.Columns[2].Model).DoGetValue(Col,Row).AsString);
         TComboBox(Control).OnChange:= ChangeStringGridComboBoxCurrency;
       end;
    end;

    I have a StringGrid (StringGridPartDet)  connected to a DataSet, I have used the attached code to update the currency column with a value from a ComboBox, the value appears correctly in the StringGrid, but does not update the DataSet. AmI missing a step?

     

     

     


  2. Thank for your suggestions Patrick. Somehow it is working again now.

     

    Interestingly Test Connection worked, but the deployment hung. No PAServer messages in verbose mode.

     

    I'm working with a Mac Laptop running Parallels, plugged into my iMac for the larger screen. The only unusual thing I did recently was to change the network Service Order 'Wi-Fi' followed by 'Thunderbolt Bridge' to get Fiddler to work properly. This morning, amongst other things,  I changed the Parallels networking type, then changed it back to Shared Network (Recommended) - turned it on and off several times and it's working, but I'm not sure why. No Firewalls active on Mac or Windows.

     

    Thanks again 


  3. My project has been working and deploying correctly to Windows and macOS, release / debug, 32/64 Windows and 64/ARM 64 Mac

     

    Today deploying to any macOS version hangs, no error message, need to go into task manager to shutdown Delphi.

     

    I haven't changed or upgraded Delphi, Windows, or macOS.

     

    Is there a way to invoke a default deployment configuration?


  4. I am getting different behaviour with a FireMonkey project between Windows 32-bit and macOS 64-bit

    In the windows version the message shows when I close the form, but not in OSX.

     

    I may be being a bad person once again with my form handling, but it all worked a treat in 10.4 with no signs of memory leaks 🤪

    procedure TForm1.Button1Click(Sender: TObject);
    var
      f : TForm2;
    begin
        f :=  TForm2.Create(nil);
        try
          f.ShowModal;
        finally
         f.Free;
        end;
    end;

     

     

    procedure TForm2.FormClose(Sender: TObject; var Action: TCloseAction);
    begin
     showmessage('Form2 FormClose');
    end;

     


  5. I have created an API in Node.JS serving data and PDFs to my Angular front end - all works perfectly. I've also added the PDF bit onto an existing Delphi App that my company uses. 

     

    There are 5 difference classes of PDF document.

     

    The Delphi app works 100% of the time, for all PDF types when I compile it for Mac OSX, however, when I run the Windows version, I get problems with 2 document types - 3 work perfectly

    (I can also use Postman to get the PDFs without any errors on all types)

    I create the PDFs on the fly in the server, and the problem PDFs are created from the same bits of server code as the ones that fail. 

     

    Error: No mapping for the Unicode character exists in the target multi-byte code page

     

    I've tried changing the headers sent from the server, and also varied the request headers:  I've tried different Content-Types and specified the charset=utf-8. 

    The simple Delphi code bellow, works for all PDF types on the Mac, but only works for a subset of the document types on Windows.

     

    (It's the RESTRequest.Execute bit that fails)

     

                    RESTClient.BaseURL                := 'https://api.mysite.com/pdf/' + url;
                    RESTREquest.Method                := rmGet;
    
                    RESTRequest.Params.AddItem;
                    RESTRequest.Params[0].Kind        :=  pkHTTPHEADER;
                    RESTRequest.Params[0].ContentType :=  ctTEXT_PLAIN;
                    RESTRequest.Params[0].Options     := [ poDoNotEncode ];
                    RESTRequest.Params[0].name        := 'authorization';
                    RESTRequest.Params[0].value       := 'Bearer ' + Token;
    
                    RESTRequest.Execute;
    
                     if RESTResponse.StatusCode = 200 then begin
    
                        RespBytes  := RESTResponse.RawBytes;

     

     

     

     


  6. I found the answer in this post https://en.delphipraxis.net/topic/2258-need-help-adding-namespaces-to-soap/

     

    InvRegistry.RegisterMethodInfo(TypeInfo(NAV_ExportCustomerItemPriceV1Soap), 'NAV_CustomerItemPriceV1', 'ReadMultiple',
                                     '[ReturnName="NAV_CustomerItemPriceV1Result"]', IS_OPTN);
    
    Params are:
    
    TypeInfo,
    InternalName,
    ExternalName,
    ReturnName,
    XMLOptions

     Setting ExternalName appears to have fixed it :classic_biggrin:

     

     

    • Like 2
    • Thanks 1

  7. The Delphi WSDL Importer has done an impressive job of taking a (local) WSDL file and generating some very useful code (that almost works!)

     

    To debug, I have looked at the outgoing request with Fiddler, and based on this, I've been able to alter the WSDL file to effect a required change in the request header.

    However, the problem remains that Delphi is generating a tag with "NAV_CustomerItemPriceV1" but the server needs "ReadMultiple" - ( which seems sensible of Delphi as the resource that it uses is called NAV_CustomerItemPriceV1)

     

    Despite further manual changes to the WSDL and to the code generated by Delphi, I can't force a change in this tag. I have seen posts where people have suggested intercepting the XML, but I'm not sure how to do this (or how to access the events on THTTPRIO)

     

    TIA

     

    Incorrect:

    <NAV_CustomerItemPriceV1 xmlns="http://tempuri.org/">
          <customerNo>account_no</customerNo>
          <apiKey>api_key</apiKey>
          <itemList>
            <Item No="T14727IO" xmlns="urn:microsoft-dynamics-nav/xmlports/NAV_CustomerItemPriceV1" />
            <Item No="ZT62062-T1E0100Z" xmlns="urn:microsoft-dynamics-nav/xmlports/NAV_CustomerItemPriceV1" />
          </itemList>
    </NAV_CustomerItemPriceV1>

     

    Correct:

    <ReadMultiple xmlns="http://tempuri.org/">
          <customerNo>account_no</customerNo>
          <apiKey>api_key</apiKey>
          <itemList>
            <Item No="T14727IO" xmlns="urn:microsoft-dynamics-nav/xmlports/NAV_CustomerItemPriceV1" />
            <Item No="ZT62062-T1E0100Z" xmlns="urn:microsoft-dynamics-nav/xmlports/NAV_CustomerItemPriceV1" />
          </itemList>
    </ReadMultiple>

     

     


  8. I have made the changes you suggested - I moved the SaveFormPos to the OnClose event of each form.  

    I did spot an extra call to SaveFormPos in one of the branches ... so that's gone.

     

    Thank you very much for your help, it is most appreciated :classic_cool:


  9. I have a project that runs in OSX only,  Just moving it to Delphi 10.4.1 (I've seen the occasional memory exception when I close [Order Detail] - but I can't recreate it)

     

    Is the nil/freeandnil the best way to deal with nested modal forms in a Firemonkey/OSX? All of the [forms] are modal and are created / freed in the same way.

     

    TIA

     

    Trevor

     

     

     

     

                    | [Customer Search] -- [Add Customer] -- [Postcode Search] (for account record)
                    |
    Main -- [Order]-| [Postcode Search] (for del address)
                    |
                    |
                    |                | [Part Search]-- [Add Part]
                    | [Order Detail] |
                                     | [Add Part]
    
    
    var
      f: TModalForm
    begin
        f  := TModalForm.Create(nil);
        f.var := 100;
        try
          SetFormPos( f );
          if f.ShowModal = mrOk then 
            begin
            // do stuff ;
            // callingForm.var := f.var
            end;
        finally
          SaveFormPos( f );
          FreeAndNil(f);
        end;
    end;

     


  10. If you installed Delphi from scratch, you'll still need to apply the patches (there's 4)

    I used RADStudio-10-4-1-esd-1461.exe to install, then I applied 3 patches as suggested by GetIt

     

    /usr/bin/xcodebuild -version -sdk
    
    xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' 
    is a command line tools instance

    I think I have both the Tools IDE and the Commnad Line Tools installed ....

    Screenshot 2020-12-22 at 10.23.19.png


  11. I noticed that 10.4 had received a patch so I thought I'd create a fresh install (Windows and Delphi).

    However, I can't add an SDK for OSX ... nothing is displayed in the SDK manager.

     

    Like pyscripter "When I try to add a new SDK nothing happens."

     

    I can't try the workaround above -

    1 - I don't have folder to rename - is this my username Documents?

    2- I don't have an entry in the SDK Manager

     

    Xcode seems to be installed correctly 

     

    Have I missed something?

    Thanks

     

     

     

×