Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 01/02/21 in Posts

  1. David Heffernan

    The Case of Delphi Const String Parameters

    Nothing to see here. Carry on using const for string parameters. The issue is vanishingly rare. If you encounter the issue, fix it. Don't go changing existing code unless you are actually affected by the issue.
  2. Shrinavat

    adding graphics32 component

    Maybe it makes sense to add graphics32 to "Delphi Third-Party" section?
  3. David Heffernan

    The Case of Delphi Const String Parameters

    That would then be a race condition between the copy and the modification. That seems like the far bigger issue.
  4. Attila Kovacs

    The Case of Delphi Const String Parameters

    I ran into this once function x(const input: string; var output: string): boolean; begun while we read input do alter output; end; if x(s,s) then; except that it wasn't easy to track down, it was a one time "achievement" in my life. Yet. given that, I consider every method having a const and var parameter of the same type as a time-bomb.
  5. Not so. In fact set of Char is actually implemented as set of AnsiChar. It has very special treatment introduced to "help" porting from ANSI Delphi to Unicode Delphi.
  6. Anders Melander

    smooth scaling of bitmaps

    Well that was easy. Luckily the bug was in my own code. Here's the code that works: procedure TFormMain.ImgViewMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer; Layer: TCustomLayer); begin if (Button = mbLeft) then begin FPanning := True; ImgView.Cursor := crSizeAll; FStartPos := Point(X, Y); end else if (Button = mbMiddle) then ImgView.Scale := 1; end; procedure TFormMain.ImgViewMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer; Layer: TCustomLayer); begin if (not FPanning) then Exit; var NewPos := Point(X, Y); var Delta := FStartPos - NewPos; FStartPos := NewPos; if (Delta.X <> 0) or (Delta.Y <> 0) then ImgView.Scroll(Delta.X, Delta.Y); end;
  7. Anders Melander

    smooth scaling of bitmaps

    My guess is that you're using the wrong TImgView32.ScaleMode. Make sure TImgView32.ScaleMode=smScale. I've attached a small example that demonstrates how to pan and zoom with TImgView32. imgview32demo.zip
×