Subject RE: [IBO] TIB_Grid embed a TButton
Author IBO Support List
You don't place an actual button in a draw cell event.
You write code that paints the button on the canvas for that cell.
I haven't ever actually used this to paint a button but this would be a good addition to the sample apps.
 
Does anyone have some example code to share for this?
 
Thanks,
Jason


From: IBObjects@yahoogroups.com [mailto:IBObjects@yahoogroups.com] On Behalf Of kostas@...
Sent: Tuesday, April 29, 2014 7:04 AM
To: IBObjects@yahoogroups.com
Subject: [IBO] TIB_Grid embed a TButton

Hello All,


I have a TIB_Grid as ReadOnly and would like to place a button in a cell.
The proberty EditLinks does not work, probably because my TIB_Grid ReadOnly is.
I have placed a button on the grid and the property visible is set to false.
In the event DrawCell I have tried to place the button. If the grid has only one record, the button is displayed.
Is more like a record exists, no button is displayed.


Does anyone have an idea?


procedure TfrUebersicht.grPosViewDrawCell(Sender: TObject; ACol,
 ARow: Integer; Rect: TRect; State: TGridDrawState);
begin
 inherited;
 with grPosView, qrPosView do
 begin
   if Active and (ACol = 7) then
   begin
     BufferRowNum := DataRow[ARow];
     if (BufferRowNum > 0) then
     begin
       btn1.BoundsRect := Rect;
       btn1.Visible := True;
     end;{if}
   end;{if}
 end;{with}

end;


thanks a lot,
Kostas