Jump to content

Remy Lebeau

Members
  • Content Count

    2684
  • Joined

  • Last visited

  • Days Won

    113

Everything posted by Remy Lebeau

  1. Remy Lebeau

    sending email with oauth2

    Yes, the ssl-oauth branch was registering the components on the palette, but I did not have actual icons for them until right before I merged the branch. I didn't have a chance to test the icons in the IDE.
  2. Remy Lebeau

    tag as String

    You can't add a new property to all components. But, the existing Tag property is a NativeInt, so it can hold a String (which is just a pointer under the hood), eg: var tagStr: NativeInt := 0; String(Pointer(tagStr)) := SomeString; SomeComponent.Tag := tagStr; ... var tagStr := SomeComponent.Tag; SomeString := String(Pointer(tagStr)); Just make sure you release the String properly before the Component is destroyed, eg: var tagStr := SomeComponent.Tag; String(Pointer(tagStr)) := '';
  3. Remy Lebeau

    sending email with oauth2

    That's good to hear, thanks. Though, PR299 is closed now. There is new effort for OpenSSL 3x support in a new repo: https://github.com/IndySockets/IndyTLS-OpenSSL https://www.indyproject.org/2024/08/05/ongoing-work-in-indy-for-openssl-updates/ Oh good, glad to see they made it onto the palette ok. The icons were a last-minute addition. https://github.com/IndySockets/Indy/wiki/Updating-Indy#delphicbuilderradstudio-101-berlin-and-later
  4. Remy Lebeau

    Close modal form by clicking outside?

    Sorry, I meant the TApplication(Events).OnDeactivate event, not the form's OnDeactivate event. You can't click on another form in your app since it has been disabled by the modal form. But, if you click outside of the app then the modal form will lose focus, triggering the TApplication(Events).OnDeactivate event. You can then close the modal form.
  5. Remy Lebeau

    Close modal form by clicking outside?

    You can call the form's Close() method, or set the form's ModalResult property, in the form's OnDeactivate event.
  6. It is generally best NOT to open an old project in a new IDE, but to instead create a new project fresh and add your existing source files to it as needed. This has always been the common advice given through the years.
  7. Remy Lebeau

    sending email with oauth2

    It doesn't matter if the username and token come from a UI or a database or a config file or an automated process. It's all the same when it gets down to the SMTP level.
  8. Remy Lebeau

    sending email with oauth2

    I have since merged the sasl-oauth branch into the master code earlier today.
  9. Remy Lebeau

    sending email with oauth2

    Yes. There has never been an satOAuth2 option for the AuthType property. The correct option is satSASL instead. And then you can add a suitable TIdSASL-derived component to the TIdSMTP.SASLMechanisms collection. But Indy's master code does not have a SASL component for OAuth yet... The status of that branch has not changed, I still need to merge it into the master branch. It is on my TODO list. In the meantime, it is possible to use the TIdSMTP.SendCmd() method to manually send the relevant XOATH2 command per Gmail's documentation (https://developers.google.com/gmail/imap/xoauth2-protocol), eg: var creds: string; creds := Format('user=%s'#1'auth=Bearer %s'#1#1, [Username, Token]); IdSMTP1.SendCmd('AUTH XOATH2 ' + TIdEncoderMIME.EncodeString(creds), ['235']); // Update the DidAuthenticate property so Send() won't try to authenticate again... IdSMTP1.AuthType := satNone; IdSMTP1.Authenticate; Alternatively, you can use the sample code from this repo: https://github.com/geoffsmith82/GmailAuthSMTP/
  10. Remy Lebeau

    TTreeView and CustomDraw

    Can you provide a more complete reproducible example? Are you suggesting that when your custom TreeView is placed on a TForm then the TreeView shows a green background, but when the TreeView is placed on a TFrame than the TreeView does not show a green background? Is it only limited to IDE plugins, or do you have the same problem if you use the TFrame in an application?
  11. Remy Lebeau

    fmxLinux missing?

    I haven't seen anything yet.
  12. Remy Lebeau

    HTTP/1.1 400 Bad Request

    The JSON spec allows whitespace between tokens. Any parser that can't handle that is broken.
  13. Remy Lebeau

    HTTP/1.1 400 Bad Request

    There is no way to diagnose that without knowing what the server considers to be bad. If the response body doesn't contain an error message with more detail, then you will have to contact the server admin so they can look at the request on their end. That being said, here are a few notes about your code... This is wrong. The Request.Host property should be just the hostname by itself (ie 'uat.mreceipts.com'). But you don't need to set the Request.Host property manually at all, TIdHTTP can handle that internally for you, so you should remove this property assignment completely. You don't need that object at all, since you are just discarding it without reading anything from it. You can pass nil to the AResponseContent parameter of TIdHTTP.Post() if you want to ignore the response body. When sending authentication manually, make sure to set the Request.BasicAuthentication property to False so TIdHTTP won't try to send an 'Authorization: Basic ...' request header. The Method and SSLVersions properties are mutually exclusive. Setting one updates the other. So you do not need to set them both. In this case, use only the SSLVersions property since you are enabling multiple TLS versions. You can remove the assignment of the Method property.
  14. Remy Lebeau

    Identifying Third-Party and Custom Components

    AFAICR, yes. My old team used BCB 5 and 6 exclusively, and when we started using source control, we had to manually set our DFMs to text format.
  15. Remy Lebeau

    Delphi 12.2 Patch 1

    According to the release announcement, you shouldn't have to reinstall any installed components, only GetIt packages.
  16. Remy Lebeau

    Simulate blocking mode to send Email

    WaitForMultipleObjectsEx() allows you to stop waiting if an I/O completion routine or APC is executed on the calling thread. That has nothing to do with message processing. You are thinking of MsgWaitForMultipleObjects() instead.
  17. Remy Lebeau

    Simulate blocking mode to send Email

    A more efficient approach would be to wait on both your EventSignal and the RTL's Classes.SyncEvent at the same time, calling CheckSynchronize() only when SyncEvent is signaled (ie, when there are sync requests pending). This way, when neither condition is true, your calling thread can actually go to sleep instead of running a busy loop. For example: uses ..., Classes, Windows; var Handles: array[0..1] of THandle; begin ... // Simulate blocking Handles[0] := oOutLook.EventSignal.Handle; Handles[1] := Classes.SyncEvent; repeat case Windows.WaitForMultipleObjects(2, @Handles[0], False, Infinite) of WAIT_OBJECT_0: Break; WAIT_OBJECT_0 + 1: CheckSynchronize; else RaiseLastOSError; until False; ... end;
  18. Remy Lebeau

    Delphi 12.2 Patch 1

    https://blogs.embarcadero.com/rad-studio-12-2-athens-inline-patch-1-available/
  19. Remy Lebeau

    Identifying Third-Party and Custom Components

    AFAIK, there are no such tools. You just have to analyze your project sources yourself. Identify which components your project uses, and which package each component comes from. Then determine whether each package comes with the IDE, was developed in-house, or was obtained from a 3rd party. It might be worth writing a small tool yourself to help you parse your DFMs/code looking for component names and use RTTI to extract unit/package information for each one. But I don't recall right now whether the RTTI in C++Builder 5 was rich enough to have that kind of information. I'll have to look next time I'm at my computer.
  20. Remy Lebeau

    creating a frame at runtime

    Interesting! I never thought of that. I learned something new today 😁 I'll definitely have to play with this in my projects.
  21. Remy Lebeau

    creating a frame at runtime

    TFrame has a virtual constructor, so you can use a meta class variable for this task, eg: type TFrameClass = class of TFrame; var Frame: TFrame; FrameClass: TFrameClass; begin ... if SomeCondition then FrameClass := TFrame2; else FrameClass := TFrame3; Frame := FrameClass.Create(Owner); ... end;
  22. Start with the Unicode section of Embarcadero's Migration and Upgrade Center. Note that AnsiString and all of the other things you mentioned still exist. You just need to be aware of how they interact with Unicode strings if you don't want to completely rewrite your code.
  23. Start with Embarcadero's Migration and Upgrade Center. A LOT has changed since the old days of C++Builder 5 (coming from someone who spent most of his career with C++Builder 6). There is no one single thing to focus on. Depending on what your codebase uses (standard C++ features/libs or Borland-specific extensions/libs), and what your goals are, you may be in for a short migration or a long one.
  24. Why not simply define a base class for the items to derive from? Then you can have an array of base items, and the derived classes can cast the items as needed. type TItemBase = class end; TAncestor = class FData: TArray<TItemBase>; // ... end; TAncestorClass = class of TAncestor; TDescendant1 = class(TAncestor) type TItem = class(TItemBase) //... end; // ... // cast FData elements to TItem as needed... end; TDescendant2 = class(TAncestor) type TItem = class(TItemBase) //... end; // ... // cast FData elements to TItem as needed... end; ...
  25. Remy Lebeau

    Folder - ReadOnly, Hidden, Normal

    The Data.DB and System.IOUtils units both define an identifier named faReadOnly (as a member of TFieldAttribute and TFileAttribute, respectively). The error message means both units are in scope and the compiler doesn't know which one you want to use. So you will have to qualify it explicitly, eg: Include(attributes, TFileAttribute.faReadOnly); Exclude(attributes, TFileAttribute.faReadOnly);
×