Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Detect resize on stringgrid column

Posted on 2000-05-11
2
Medium Priority
?
1,516 Views
Last Modified: 2008-03-03
In Delphi 5, is there a way to detect when a TStringGrid column is being resized?
0
Comment
Question by:jpoz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 2

Accepted Solution

by:
rene100 earned 30 total points
ID: 2802023
ok, here it comes:

unit StringGridEx;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  Grids;

type
  TStringGridEx = class(TStringGrid)
  private
    FColWidthsChanged: TNotifyEvent;
    procedure ColWidthsChanged; override;
    { Private declarations }
  protected
    { Protected declarations }
  public
    { Public declarations }
  published
    property OnColWidthsChanged: TNotifyEvent read FColWidthsChanged write FColWidthsChanged;
    { Published declarations }
  end;

procedure Register;

implementation

procedure Register;
begin
  RegisterComponents('Eigene', [TStringGridEx]);
end;

procedure tStringgridEx.ColWidthsChanged;
begin
inherited;
if Assigned(OnColWidthsChanged) then
   OnColWidthsChanged(Self)
end;
end.

now every time the width of a column has has been changed, OnColWidthsChanged is called.

regards
rene



0
 

Author Comment

by:jpoz
ID: 2802176
Very quick reply, I actually came up with another solution.  However, 'A' for effort, you can have the points.

My answer - in OnMouseUp, I determined where the mouse was based on the CellRect, and determined if it was within the area where the resize occurs.

procedure StringGrid1.OnMouseUp(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState;
  X, Y: Integer)
var
  CellRect : TRect;
begin
  CellRect :=
    StringGrid1.CellRect(CellCoord.x,
                         CellCoord.y);

  if (x >= (CellRect.Right-3))
     or (x <= (CellRect.Left+3)) then
   { resize detected }
end;
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question