![]() |
Auf ColSizing reagieren?
Hallo zusammen,
Kann man irgendwie auf relativ einfache Art auf das ColSizing eines StringGrids reagieren? Hintergrund : ich habe im OnMouseActivate eines Grids ne Funktion zum Sortieren des Grids drin, Wenn ich jetzt aber "nur" die Spaltenbreite ändern will, wird die Sortierfunktion auch ausgelöst, was aber natürlich nicht so sein soll. MfG :angel: |
Re: Auf ColSizing reagieren?
Hallo
evt. hilft es die Methode MouseUp zu überschreiben
Delphi-Quellcode:
unit Unit1;
interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, Grids, StdCtrls; type TJsStringGrid = class(TStringGrid) private FOnSizing: TNotifyEvent; protected procedure ColSizing; virtual; procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override; published property OnSizing : TNotifyEvent read FOnSizing write FOnSizing; end; TForm1 = class(TForm) Label1: TLabel; procedure FormCreate(Sender: TObject); private { Private-Deklarationen } FGrid : TJsStringGrid; procedure Sizing(Sender : TObject); public { Public-Deklarationen } end; var Form1: TForm1; implementation {$R *.DFM} procedure TForm1.Sizing(Sender: TObject); begin Label1.Caption:=IntToStr(StrToInt(Label1.Caption)+1); end; { TJsStringGrid } procedure TForm1.FormCreate(Sender: TObject); begin FGrid:=TJsStringGrid.Create(Self); FGrid.Top:=20; FGrid.Left:=20; FGrid.Options:=FGrid.Options + [goColSizing]; FGrid.OnSizing:=Sizing; FGrid.Parent:=Self; end; { TJsStringGrid } procedure TJsStringGrid.ColSizing; begin If (Assigned(FOnSizing)) and (FGridState=gsColSizing) then FOnSizing(Self); end; procedure TJsStringGrid.MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin ColSizing; inherited MouseUp(Button,Shift,X,Y); end; end. |
Alle Zeitangaben in WEZ +1. Es ist jetzt 17:56 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz