Jump to content

Recommended Posts

Posted
Hi Mohammad Hamdan.
 
Try this:
 
uses ... Vcl.Grids ...
type TMyStringGrid = class (TUniStringGrid)
  FGrid: TStringGrid;
  public
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;
end;
{ TMyStringGrid }

constructor TMyStringGrid.Create(AOwner: TComponent); 
begin 
  inherited; 
  FGrid := TStringGrid.Create(nil);  
end; 

destructor TMyStringGrid.Destroy; 
begin   
  FGrid.Free;   
  inherited; 
end;

 

Example:

 

procedure TMainForm.UniButton1Click(Sender: TObject);
var
  MyStringGrid: TMyStringGrid;
begin
  MyStringGrid := TMyStringGrid.Create(Self);
  with MyStringGrid do begin
    Align := alTop;
    ColCount := 10;    
    RowCount := 10;
    Parent := Self;   
  end;   
  MyStringGrid.Cells[1, 1] := 'Test';   
  MyStringGrid.FGrid.Objects[1, 1] := TObject(5);   
  ShowMessage(IntToStr(Integer(MyStringGrid.FGrid.Objects[1, 1])));   
end;
 
Sincerely ...
  • Upvote 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...