Delphi32.com - Home!
| Home/News | Downloads | Forums | D32 Magazine | Resources | Info and Facts |  
 
 Creating a custom TInplaceEdit for TDBGrid


How can I customize the cell editor for a TDBGrid?   

    You should create a custom TInPlaceEdit for use within Grids.

    Following is an example component:

    unit CustomEditorGrid;

    interface

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

    type TMyInplaceEdit = class(TInplaceEdit) public procedure DblClick; override; end;

    TCustomEditorGrid = class(TDBGrid) private { Private declarations } protected { Protected declarations } function CreateEditor: TInplaceEdit; override; public { Public declarations } published { Published declarations } end;

    procedure Register;

    implementation

    const SomeDefaultValue = 'Default Value';

    procedure Register; begin RegisterComponents('Custom', [TCustomEditorGrid]); end;

    { TCustomEditorGrid }

    function TCustomEditorGrid.CreateEditor: TInplaceEdit; begin Result := TMyInplaceEdit.Create(Self); end;

    { TMyInplaceEdit }

    procedure TMyInplaceEdit.DblClick; begin inherited DblClick;

    if (Text = '') then Text := SomeDefaultValue; end;

    end. 4/ /99 :32:33 AM

     



  << Previous Faq     Complete List     Next Faq >>  



 
 Hits/month  2,500,000+ 
 Downloads
 (Since May 2000)
 7,393,709 
 Total Files  6,023 
 Forum msgs  7,670 
 Articles/FAQs  70+/900+ 
Kylix
Tips n Tricks
FAQs
Knowledge Base
Bug Listings
Articles
Books
Newsgroups
Links
Submissions
Testimonials
Advertising
Contact Us
About Us
Search Amazon:
Top Selling Software at Amazon

| Home/News | Downloads | Forums | Resources | Info and Facts | Testimonials |
  Site Search:
 


Comments/Problems: Webmaster@delphi32.com
Copyright © 1998-2006, Delphi32.com. All rights reserved.
Terms of Use