Jump to content

corneliusdavid

Members
  • Content Count

    417
  • Joined

  • Last visited

  • Days Won

    6

Posts posted by corneliusdavid


  1. Any component can be created in code at runtime. Here's the code for your posted set of components:

    var
      RESTClient1: TRESTClient;
      RESTRequest1: TRESTRequest;
      RESTResponse1: TRESTResponse;
    begin
      RESTClient1 := TRESTClient.Create(Self);
    
      RESTClient1.Name := 'RESTClient1';
      RESTClient1.BaseURL := 'https://api-eu1.XXXXXXXXXXXXXXX/ORD';
      RESTClient1.Params := <>;
    
    
      RESTRequest1 := TRESTRequest.Create(Self);
    
      RESTRequest1.Name := 'RESTRequest1';
      RESTRequest1.AssignedValues := [rvConnectTimeout, rvReadTimeout];
      RESTRequest1.Client := RESTClient1;
      RESTRequest1.Method := rmPOST;
      with RESTRequest1.Params.Add do begin
        Kind := pkHTTPHEADER;
        Name := 'x-api-compleat-key';
        Value := '0aXXXXXXXXXXXXXXXXXXXXXX94';
      end;
      with RESTRequest1.Params.Add do begin
        Kind := pkREQUESTBODY;
        Name := 'body9BE6CF603159471FB026D7FF6FC3D2DB';
        Value := ;
        ContentType := ctAPPLICATION_JSON;
      end;
      RESTRequest1.Response := RESTResponse1;
    
      RESTResponse1 := TRESTResponse.Create(Self);
    
      RESTResponse1.Name := 'RESTResponse1';
    end;

    The GExperts IDE plugin has a very easy way to generate this. After it's installed, simply right+click on a component and select "Components to Code" and the code to generate the component is copied to the clipboard. Then just paste them into your code editor.  It does one component at a time so I had to combine the three RESTxxx components into the VAR section after each one but it's really as simple as that.

    • Like 1

  2. I think I would split the string on semicolons and run the regex on each individual address.

    function ValidEmail(const EmailAddress: string): Boolean;
    const
      EMAIL_REGEX = '^((?>[a-zA-Z\d!#$%&''*+\-/=?^_`{|}~]+\x20*|"((?=[\x01-\x7f])' + '[^"\\]|\\[\x01-\x7f])*"\x20*)*(?<angle><))?((?!\.)' +
        '(?>\.?[a-zA-Z\d!#$%&''*+\-/=?^_`{|}~]+)+|"((?=[\x01-\x7f])' + '[^"\\]|\\[\x01-\x7f])*")@(((?!-)[a-zA-Z\d\-]+(?<!-)\.)+[a-zA-Z]' +
        '{2,}|\[(((?(?<!\[)\.)(25[0-5]|2[0-4]\d|[01]?\d?\d))' + '{4}|[a-zA-Z\d\-]*[a-zA-Z\d]:((?=[\x01-\x7f])[^\\\[\]]|\\' +
        '[\x01-\x7f])+)\])(?(angle)>)$';
    var
      Emails: TStringList;
    begin
      Result := True;
    
      Emails := TStringList.Create;
      try
        Emails.Delimiter := ';';
        Emails.StrictDelimiter := True;
        Emails.DelimitedText := EmailAddress;
        for var i := 0 to Emails.Count - 1 do
          if not IsMatch(Emails[i], EMAIL_REGEX) then
          begin
            Result := False;
            Break;
          end;
      finally
        Emails.Free;
      end;
    end;

     

    • Like 2

  3. Just because it doesn't have features you think are necessary doesn't mean it's useless. I really like this new window as I can open this up and move it to a second monitor so I can see either a different section of the code or the design view of the form while editing the code. In this use case, it wouldn't make sense to have it dockable. Also, I wouldn't need it for every unit, just occasionally for some forms or data modules--when I need it, the feature is there. I can see the benefit for making it dockable and saving it as part of a desktop layout but that's not the first thing I thought of.

     

    I'm glad they added this feature. Perhaps there will be a dot release with enhancements you suggest.

    • Like 1

  4.  

    9 hours ago, FranzB said:

    Reading an  " "  empty field I get an exception failure.

    If you know there's a space in the field, then the code you listed, "Fieldbyname('IntegerField').AsInteger" is misleading as that is most definitely NOT an IntegerField as Integer fields cannot have spaces (well, SQLite might allow it). If your "integer" field might possibly contain values other than integers, you will have no choice but to test to make sure it actually contains an integer before trying to use it as one. The AsInteger function doesn't check the data type, it just assumes you know what you're doing with your database.

    • Like 1

  5. Does anyone know if there will be documentation and/or source for supporting the new Welcome Page plugins in Delphi 11? I like this version's Welcome page much better than previous versions and it's nicely configurable but would still like to be able to create my own additions.

     

    I see several WelcomePage.Plugin.XXX packages in the \bin folder and listed under "Known IDE Packages" in the registry but there doesn't seem to be any corresponding source code in the source\ToolsAPI folder of the Delphi 11 installation.


  6. 10 minutes ago, Gary said:

    If you skipped the Interbase install, does firedac connect to the databases in Data Explorer?

    Yes, FireDAC can connect to local or remote database, the same as IBConsole and you can view remote data from within the Delphi IDE. You just specify the SERVER and PORT to point to the other machine. And, of course, remember that the database filename is local to the SERVER, not the local machine (e.g. don't give the network share name of the location of the database).

     

    13 minutes ago, Gary said:

    It asked if I wanted multiple instances, I said yes and was able to set up 2 different ones.

    One thing to keep in mind if you have multiple instances of InterBase: each one has to be licensed separately--you can't use the same license for two different ones.  It'll probably run fine for a short while but you'll soon run into the license problem like I did.


  7. 8 minutes ago, Gary said:

    if you select Interbase as a feature when installing

    When I installed Delphi 11, I skipped the InterBase install since I already had IB 2020 installed so I only have one instance of IB 2020 installed on my developer machine.

     

    9 minutes ago, Gary said:

    I see you have multiple server instances in IBConsole. How did you set them up?

    OK, I should explain--that screenshot is misleading. I originally installed IB 2020 with Delphi 10.4 on my developer machine. Then, I started doing some testing with web modules on my Windows Server under IIS so installed IB 2020 on there. After I registered that and started using it there, when I try to open a database on my developer machine, it tells me the license is already in use. I need to uninstall it from my developer machine--the only one I can really use in that screenshot is the one at the IP address that points to my Windows server.  I included the screenshot to show that it's possible to register multiple databases with different instance names and ports. Sorry for the confusion.

     

    But to answer your question about how to setup up multiple databases in IBConsole (if that's what you wanted to know), when you right+click on "InterBase Servers" and select Add..., you get prompted for local or remote.  For my Windows Server, I selected Remote and entered it like this:

    image.png.699c0d417a4a99dc8c3317022549a0fe.png

     

    Hope that helps.


  8. On 9/16/2021 at 4:03 AM, Mike Torrettinni said:

    Is it possible to somehow see what is current project branch I'm working on, in IDE?

    I don't think your original question was ever answered--lots of other information, though.

     

    To answer your question, No, the Delphi IDE does not show the current Git branch, only recent commits. It has a nice difference viewer that augments the History pane of the editor but that's it; it uses the current branch of the repository folder.


  9. 4 hours ago, Rollo62 said:

    Simpler, yes, but the "Ex" receives also more information

    True, but digging through the sub-properties to get what I want is so much more work than simply grabbing the value from the memory table to which it's attached. There might be times when this is necessary but I'd much rather use LiveBindings get the original value from the table.

     

    By the way, the working project is on GitHub under the name, AppPaths.

    • Thanks 1

  10. Can you show the table structure or at least the INSERT statement that would trigger this?  I suspect it might have to do with New.ITEMNO as that's filtering out the records for which the UPDATE statement would work with.

    • Like 1

  11. I checked the difference in my form and no properties changed from what works now and what didn't the other day. I'm wondering if simply changing a property, compiling, then changing it back activated something in the compilation that should've been enabled in the first place.  I've seen this once before in a different component (I don't remember which).

     

    I still want to learn more about the sub-properties of the TListItemDrawable item returned in the OnItemClickEx event but for now, ItemClick is working--and simpler to use.


  12. I tried OnTap but it doesn't indicate which item was clicked.

     

    I was playing around and enabled a property that got OnItemClick to work on Mac/iOS!  Tomorrow, I'll have to go back carefully and hunt down which property did the trick.


  13. Thanks for this suggestion. There is an ItemClickEx event I can hook into that does work the same on all platforms and gives me the ItemIndex to the list view items.  I guess I need to figure out how to get at the properties of the item. It's not a simple Text field but a variable list of objects and object types. I was hoping to be able to use something simpler.


  14. I've got a very simple cross-platform app with a TListView on the main form and when you click on an item, it should fire an event which takes the user to the next tab and displays details about the item that was clicked. I want to use OnItemClick so that it updates the current record of a memory table it's hooked to via LiveBindings.

     

    For the Windows platforms, this works perfectly as expected. On iOS, there is no OnItemClick event fired. On Mac, I can use the arrow key, then the space bar to activate it but not the mouse.

     

    I tried this a couple of days ago with Delphi 10.4.2, found a reported issue that was supposedly fixed in 10.4.1 (I can't find the issue now), and just tried it again today in Delphi 11 but I still have the same problem.

     

    Does TListView's click events behave differently on mobile devices? Is there a separate event I can use if I want to use the Accessory Button instead?  I've found lots of information to configure viewing data in a TListView but not much in responding to events. Any clues would be most appreciated.


  15. It let's you download and start the install but you don't get very far into the installation before it asks for your license key. Once it determines you're not licensed for that version, it halts the upgrade process, then you're left to reinstall the previous version since the first step of installing an upgrade is to uninstall the current version.

     

    So yeah, if you know you're not licensed for the new version, don't try as you'll just waste a bunch of time. 😕

×