Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 12/17/23 in all areas

  1. Hello, this is the information that a version 2.1 of Delphi Code Coverage Wizard Plus has been released today. It can be found here: https://github.com/MHumm/delphi-code-coverage-wizard-plus/releases/tag/V2.1 and hopefully soon via Tools/GetIt package manager. What's new? updated code coverage command line tool used fixed duplicate accelerator keys on generate and run menu/page added support for new -ecp class prefix exclusion parameter added support for new -lcl parameter added support for new -ife and -efe parameters made Delphi 12.0 Athens known to the tool for IDE tools menu integration Enjoy TurboMagic
  2. Remy Lebeau

    How to keep hdc alive

    But you didn't explain earlier WHY you need to preserve the HDC, only that you want to use it across "two tasks", without any example or explanation of what those tasks actually are. And, as Delija already mentioned, you can simply Lock the TBitmap's Canvas to prevent the VCL from releasing the HDC automatically. Just make sure you Unlock it before you resize or free the TBitmap, and re-Lock it again after resizing. That makes no sense. If you are using the TBitmap's HDC for both functions, then there is no need to wait for a paint event to draw the string onto the TBitmap. Since you are not drawing the string onto a display HDC directly, there is no need to wait for a paint event. You can just draw onto the TBitmap whenever you want, since it is all just in-memory data. If you want to draw the TBitmap onto a display Canvas so the user can see the image, that certainly needs to be done in a paint event, but that does not mean you have to draw onto the TBitmap itself in the paint event. And in fact, you shouldn't do it that way. Prepare the TBitmap image ahead of time, and then just draw the TBitmap as-is whenever a paint event occurs, and then invalidate the display window whenever the TBitmap image changes so a new paint event can display the updated image. And this way, you don't even need the TBitmap's HDC to be persistent over time, you only need it when you are updating your image. For example: type TTextPanel = class(...) private procedure BmpChanged(Sender: TObject); procedure UpdateData; protected procedure Paint; override; procedure SetBounds(ALeft, ATop, AWidth, AHeight: Integer); override; public constructor Create(AOwner: TComponent); override; destructor Destroy; override; end; constructor TTextPanel.Create(AOwner: TComponent); begin inherited Create(AOwner); FBmp := TBitmap.Create; FBmp.OnChange := BmpChanged; end; destructor TTextPanel.Destroy; begin FBmp.Free; inherited Destroy; end; procedure TTextPanel.BmpChanged(Sender: TObject); begin Invalidate; end; procedure TTextPanel.Paint; begin inherited Paint; ... Canvas.Draw(0, 0, FBmp); ... end; procedure TTextPanel.SetBounds(ALeft, ATop, AWidth, AHeight: Integer); begin inherited SetBounds(ALeft, ATop, AWidth, AHeight); FBmp.SetSize(Width, Height); UpdateData; end; procedure TTextPanel.UpdateData; begin // update FBmp image as needed... end; I think you are making this task harder than it really needs to be. If you think I'm wrong, feel free to provide an example demonstrating exactly what you are trying to accomplish.
  3. I don't, but I know how to let the remote work find you: Answer questions on stackoverflow. Answer questions here. Participate in open-source projects. Of course, it helps immensely if you can do that within a narrow field of expertise (to minimize the competition) - or better than most. If you can stomach the self-promoting nonsense in the LinkedIn Delphi group you can also try posting there. I don't use it myself (as I wouldn't be able to behave). ...and start by changing your screen name. I assume your last name isn't 23668... If I wanted to I could live off the remote & freelance offers I get because my name comes up when clients google for info on some special tech they need help with.
  4. Remy Lebeau

    How to keep hdc alive

    Why are you creating an HDC to begin with? TBitmap already has its own HDC that it manages for you. Just draw on your TBitmap whenever you need to. What are you trying to accomplish exactly by managing your own HDC manually? You don't need that 2nd step. You can't. Resizing a bitmap will destroy its old data. But TBitmap will handle copying the old data into the new memory for you. You would have had to do that yourself with a manual HDC, so better to just let TBitmap do it for you.
  5. Dalija Prasnikar

    How to keep hdc alive

    VCL implements "garbage collection" for unused device contexts and it periodically releases them. To prevent that you need to call Lock on Canvas, and call Unlock when you no longer need the same device context. But, without seeing your code it is hard to say whether there is more going on.
  6. Chris Pim

    Delphi 11.3 issue with iOS Today Extension widgets

    The only solution we came up with for this was: 1. Copy the fully signed extension from XCode into the Delphi project (in our case deployed to the PlugIns folder). 2. Do a full build and deploy with Delphi (which damages the appex by re-signing with the wrong entitlements file) 3. Manually run a script which copies the original binary of the appex over the top of the one Delphi re-signs in the .app generated in the scratch-dir so it’s correct again. 4. The script then also has to re-run the iosinstall command to deploy the fixed app to the device. To help with step 3, I have the original binary from inside the .appex included in the deployment twice. Once into the PlugIns folder as expected and a second to ../ which puts a copy into the scratch-dir folder. By doing this, my script for stage 3 knows where to get the original file from and it’s always the pre-broken version. This works fine but has the manual step at the end which is a pain. Delphi doesn’t have a post-deploy stage in the project build options (like it does for post-build) which is a shame as the “copy-back” step could just be included there if it did. With any luck, EMB will undo the “fix” that broke this in 11.3 so it isn’t needed anymore. Maybe we should all vote for the issue to push it up their priority list.
×