お知らせ

電子会議

ライブラリ

パレット

Delphi FAQ検索

Delphi FAQ一覧

サンプル蔵





FDelphi FAQ
16番会議室「玉石混淆みんなで作るSample蔵」に寄せられたサンプル

"StringGridで入力終了時にイベントを発生"

この発言に対し以下のコメントが寄せられています
#00748 りゅー さん RE:StringGridで入力終了時にイベントを発

StringGridから継承したコンポーネントで、セルの入力直後にイベントを発生 させる機能と、セルの最大文字数を設定する機能をもったもののサンプルで す。 unit StringGridX; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, Grids; type TStringGridX = class(TStringGrid) private { Private 宣言 } FCellMax: Integer; FOnSetEditTextEX: TSetEditEvent; FCol, FRow: LongInt; FValue: String; protected { Protected 宣言 } function GetEditLimit: Integer; Override; procedure SetEditText(ACol, ARow: Longint; const Value: string); override; procedure WMCommand(var Message: TWMCommand); message WM_COMMAND; public { Public 宣言 } constructor Create(AOwner: TComponent); override; published { Published 宣言 } property CellMaxLength: Integer read FCellMax write FCellMax default 0; property OnSetEditTextEX: TSetEditEvent read FOnSetEditTextEX write FOnSetEditTextEX; end; //procedure Register; implementation //procedure Register; //begin // RegisterComponents('Samples', [TStringGridX]); //end; constructor TStringGridX.Create(AOwner: TComponent); begin inherited Create(AOwner); FCellMax := 0; FCol := 0; FRow := 0; FValue := ''; end; function TStringGridX.GetEditLimit: Integer; begin if FCellMax > 0 then Result := FCellMax else Result := Inherited GetEditLimit; end; procedure TStringGridX.SetEditText(ACol, ARow: Longint; const Value: string); begin FCol := ACol; FRow := ARow; FValue := Value; inherited SetEditText(ACol, ARow, Value); end; procedure TStringGridX.WMCommand(var Message: TWMCommand); begin with Message do begin if (InplaceEditor <> nil) and (Ctl = InplaceEditor.Handle) then case NotifyCode of EN_KILLFOCUS: if Assigned(FOnSetEditTextEX) then FOnSetEditTextEX(Self, FCol, FRow, FValue); end; end; inherited; end; end. // 「DELPHIでOOを実践する会」会員 兼 MES19のダークサイダー // //  E-Mail: abetaka@rose.ocn.ne.jp               // KGC01133 りゅー Original document by りゅー 氏 ID:(KGC01133)



ここにあるドキュメントは NIFTY SERVEの Delphi Users' Forum の16番会議室「玉石混淆みんなで作るSample蔵」に投稿されたサンプルです。これらのサンプルはボーランド株式会社がサポートする公式のものではありません。また、必ずしも動作が検証されているものではありません。これらのサンプルを使用したことに起因するいかなる損害も投稿者、およびフォーラムスタッフはその責めを負いません。使用者のリスクの範疇でご使用下さい。

Copyright 1996-2002 Delphi Users' Forum