Jump to content

Lars Fosdal

Administrators
  • Content Count

    3518
  • Joined

  • Last visited

  • Days Won

    115

Lars Fosdal last won the day on May 26

Lars Fosdal had the most liked content!

Community Reputation

1859 Excellent

Technical Information

  • Delphi-Version
    Delphi 12 Athens

Recent Profile Visitors

28957 profile views
  1. Lars Fosdal

    Share a data between two units in dynamic loaded BPL.

    Isolate your business logic from the UI. Use an intermediate class to pass the data around.
  2. Lars Fosdal

    Delphi 13 beta

    If you currently are a Delphi/RAD Studio subscriber, you can request access to the beta if you didn't already get an invite. As per the link in the starting post of this thread: Closing this thread.
  3. Lars Fosdal

    Share a data between two units in dynamic loaded BPL.

    I would decouple the action by having a handler. unit Druga; interface uses Dialogs; function Demo:boolean; type TOnShowMessage = reference to procedure; var OnShowMessage: TOnShowMessage; implementation // No circular ref here function demo: boolean; begin if Assigned(OnShowMessage) then OnShowMessage else raise Exception.Create('Someone forgot to set the OnShowMessage handler'); end; initalization OnShowMessage := nil; end. In Prva, I'd connected the handler in f.x. FormCreate; procedure TForm1.FormCreate(sender: TObject); begin Druga.OnShowMessage(Self.MyShowMessage); end; procedure TForm1.MyShowMessage; begin ShowMessage(Form1.Edit1.Text); end; This avoids the circular unit ref, and since you initialize the handler from the main form, it shouldn't matter if the bpl is dynamically loaded? If you want to, you can of course also add parameters to the handler to display a text generated in unit Druga or have multiple handlers for different uses.
  4. @dmitrybv I assume that in your real code, you retrieve the correct installation paths from registry? Edit: Also, see this for executing shell commands:
  5. Lars Fosdal

    Delphi 13 beta

    @RDP1974 Dave is correct. Please remove your comment.
  6. It is possible to add a comment to the issue, but not sure if that would be more hurtful than helpful.
  7. Lars Fosdal

    Define conditional symbol in .dpr

    You can also define symbols in an environment variable, but then they apply to ALL projects you compile. dcc_define=Test;MagicSymbol;SomeOtherDefine dcc_define being the magic environment variable name which defines the symbols. Example: This one defines "foslar" - so that I can include code that I am working on but which doesn't compile in the project and commit/push to git without breaking the build server or messing up for other users. {$ifdef foslar} procedure DoSomething begi What was I thinking? {$endif}
  8. Lars Fosdal

    What .PAS file does a form use?

    Version Control.
  9. Lars Fosdal

    Introducing My Delphi TFuture PPL For Thread Safe UI

    TEventually<T> 😛
  10. Lars Fosdal

    Introducing My Delphi TFuture PPL For Thread Safe UI

    But you are still blocking, if looping around a wait. Are you going to put a ProcessMessages in that loop?
  11. Lars Fosdal

    Introducing My Delphi TFuture PPL For Thread Safe UI

    Wait = Block. Events = Asynch w/o block.
  12. Lars Fosdal

    Recommendation on VCL development on 4k monitor

    I have a 5K 40" Lenovo, that can be split into two "virtual" displays. I can set up different resolutions and scalings on those when I need to test HighDPI. Generally speaking, the test results are so disheartening that I still stick with 100% scaling in the OS, and use BDS in DPI-Unaware mode.
  13. Lars Fosdal

    Introducing My Delphi TFuture PPL For Thread Safe UI

    Generally speaking I prefer offloading background tasks to a threadpool in-queue. The threadpool messages the main thread when the work is done. The main thread then retrieves the response from the threadpool out-queue.(i.e. mailbox principle). If there are multiple parallell tasks (i.e. a job), the main thread will need to know that, and whenever a thread completes, check if it fullfill the needs of the job and then fire off whatever should happen after the job is complete. There really is no single best way to deal with background processing - except ensuring that the main thread is not blocked.
  14. Lars Fosdal

    How to use Swagger via MARS REST API?

    I see there are several attributes relevant for the Swagger data, such as RequestParamAttribute, but I see very few examples of use. Github: search for "Param]" (without the quotes) I woud suggest you experiment with those to see what you get.
  15. Lars Fosdal

    How to use Swagger via MARS REST API?

    Ah, so how to generate complete Swagger info from your MARS API?
×