Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 11/04/23 in Posts

  1. Carlo Barazzetta

    Shell Controls: losts... and found!

    A HIDDEN GEM IN DELPHI SOURCES (SHELLCONTROLS) Many times I intercept requests on the WEB from Delphi developers for components of the Windows "Shell" (similar to Windows Explorer) that were once present in Delphi (maybe in Delphi XE3), which have "disappeared" from the Delphi components palette. Those components are: - TShellComboBox - TShellListView - TShellTreeView - TShellChangeNotifier The good news is that those components are still there and have also been updated over time, but the packages are missing and are therefore not installed "by default" in the Delphi IDE 🙁 So we have prepared a Repo on Git-Hub containing the packages of these components, to facilitate their installation in the Delphi IDE and therefore their use. The prepared packages are for different versions of Delphi, starting from Delphi XE6 up to Delphi 12 and are available here: https://github.com/EtheaDev/DelphiShellControlsPackages In the same repository there is also a small Demo that shows the components "in action", also reconstructed from a demo present only for C++ and transformed in Delphi Pascal. bye Carlo
  2. Remy Lebeau

    StringGrid: how to get the column number via right-click

    Your 'c' variable is initialized to 0, which is likely why your column 0 gets highlighted at startup. Initialize the variable to -1 instead, and then update it on mouse clicks as needed. Also, you don't need to use the OnSelectCell event at all, just let the OnMouseDown code determine the column using the provided X/Y coordinates. Also, DO NOT call your OnDrawCell event handler direct!y. Let the system call it for you when the Grid actually needs to be painted naturally. Try something more like this instead: implementation var HighlightedColumn: Integer; ... procedure TForm1.FormCreate(Sender: TObject); begin HighlightedColumn := -1; end; procedure TForm1.sg1DrawCell(Sender: TObject; ACol, ARow: Integer; Rect: TRect; State: TGridDrawState); begin if (ACol = HighlightedColumn) then begin sg1.Canvas.Brush.Color := clBlue; sg1.Canvas.FillRect(Rect); end; end; procedure TForm1.sg1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); var c, r: Longint; begin sgl.MouseToCell(X, Y, c, r); if (r < sgl.FixedRows) then begin HighlightedColumn := c; sg1.Invalidate; end; end;
  3. David Heffernan

    Is it a problem if I create more threads than host CPU has ?

    Why would that be? Would it be because you asked a technical question without offering any details. Using more threads than processors can be effective when some of the tasks aren't CPU bound. A good example would be writing to or ready from disk. Accessing memory as the task I would not expect to be amenable to using more threads than processors. Usually computers have greater peak CPU throughput than memory throughout. So if the work is purely memory access then I'd expect CPUs to be idle. Because the memory access should be the bottleneck. You are quite right when you point out that nobody can advise you accurately without knowing your precise needs.
  4. Kas Ob.

    Minimizing Forms

    It would be nice if share with us your final result for best solution, and thank you in advance.
×