BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Putting a dbgrid and four bitbtns in one component

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> comp.lang.pascal.delphi.components.misc
View previous topic :: View next topic  
Author Message
hafezrabbani@gmail.com
Guest





PostPosted: Sat May 14, 2005 6:22 am    Post subject: Putting a dbgrid and four bitbtns in one component Reply with quote



Hi everybody!
I want to put a dbgrid and four BitBtns in a component, but I dont want
to put them in a frame because I want to encapsulte it better.
I know that I should creat a new package but I don't know what to do
then.
Maybe I should inherit the package class from TFrame and put dbgrid and
BitBtns on it, but when I want to put that component in a form, delphi

sends a message that It doesn't find components resource.
What should I do?

The source is here:


unit UnitGridset;

interface

uses
SysUtils, Classes, Controls, Grids, DBGrids, UnitTScrollDBGrid,
Buttons, Forms;

type
TGridSet = class(TCustomFrame)
private
{ Private declarations }
DBGrid:TScrollDbgrid;
BitBtnNext:TBitbtn;
BitBtnPrior:TBitbtn;
BitBtnFirst:TBitbtn;
BitBtnLast:TBitbtn;
protected
{ Protected declarations }
constructor Create(AOwner:TComponent);override;
destructor Destroy;
public
{ Public declarations }
published
{ Published declarations }
property width;
property Height;
end;

procedure Register;

implementation

procedure Register;
begin
RegisterComponents('Samples', [TGridSet]);
end;

{ TScrollDBGrid1 }

constructor TGridSet.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
Parent:=(AOwner as TWinControl);
DBGrid:=TScrollDBGrid.Create(self);
DBGrid.Parent:=Self;
DBGrid.Top:=0;
DBGrid.Left:=0;
inherited Height:=320;
inherited width:=200;

DBGrid.Height:=inherited Height-35;
DBGrid.Width:=inherited Width;

BitBtnNext:=TBitBtn.Create(AOwner);
BitBtnPrior:=TBitBtn.Create(AOwner);
BitBtnFirst:=TBitBtn.Create(AOwner);
BitBtnLast:=TBitBtn.Create(AOwner);

BitBtnNext.Parent:=Self;
BitBtnPrior.Parent:=Self;
BitBtnFirst.Parent:=Self;
BitBtnLast.Parent:=Self;

BitBtnNext.Width:=30;
BitBtnPrior.Width:=30;
BitBtnFirst.Width:=30;
BitBtnLast.Width:=30;

BitBtnNext.Height:=30;
BitBtnPrior.Height:=30;
BitBtnFirst.Height:=30;
BitBtnLast.Height:=30;

BitBtnNext.Top:=inherited Top + inherited Height +10;
BitBtnPrior.Top:=inherited Top + inherited Height +10;
BitBtnFirst.Top:=inherited Top + inherited Height +10;
BitBtnLast.Top:=inherited Top + inherited Height +10;

BitBtnNext.Left:=inherited left + 10;
BitBtnPrior.Left:=inherited left + 45;
BitBtnFirst.Left:=inherited left + 80;
BitBtnLast.Left:=inherited left + 115;


BitBtnNext.BringToFront;
BitBtnPrior.BringToFront;
BitBtnFirst.BringToFront;
BitBtnLast.BringToFront;
end;

destructor TGridSet.Destroy;
begin
DBGrid.Destroy;
BitBtnNext.Destroy;
BitBtnPrior.Destroy;
BitBtnFirst.Destroy;
BitBtnLast.Destroy;
inherited ;
end;

end.


Thanks a lot for your help.
Hafez Rabbani

Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> comp.lang.pascal.delphi.components.misc All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.