Jump to content


Photo

Custom Cells.


  • Please log in to reply
7 replies to this topic

#1 Speed

Speed
  • Members
  • 87 posts

Posted 23 June 2020 - 12:32 PM

Hi Boki,

 

I'd like to be able to have some cells that occupy more than one row in a column.  Is it possible to do this, as shown in the attached image?

 

The coloured cells in the image are just a mock up.

 

Thanks.

 

= Steve

 

Attached Files



#2 Speed

Speed
  • Members
  • 87 posts

Posted 25 June 2020 - 02:42 PM

Any suggestions?



#3 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 7,893 posts
  • Gender:Male

Posted 27 June 2020 - 05:46 PM

Unfortunately this is not that easy to accomplish.

 

I'm still not sure how it can be done.


boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Members Section: bms.bergsoft.net
Articles and Tutorials: dn.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#4 Speed

Speed
  • Members
  • 87 posts

Posted 28 June 2020 - 02:11 AM

Unfortunately this is not that easy to accomplish.

 

I'm still not sure how it can be done.

Would it be possible with NextGrid 5?

 

= Steve



#5 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 7,893 posts
  • Gender:Male

Posted 28 June 2020 - 02:29 AM

I think it will be the same difficulty.


boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Members Section: bms.bergsoft.net
Articles and Tutorials: dn.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#6 Speed

Speed
  • Members
  • 87 posts

Posted 28 June 2020 - 04:22 AM

Hi Boki,

 

Never mind, I worked out how to do it.

 

= Steve

 

 

Attached Files



#7 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 7,893 posts
  • Gender:Male

Posted 28 June 2020 - 12:19 PM

How you done it :) Did you really merged them, or just painted the colors?


boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Members Section: bms.bergsoft.net
Articles and Tutorials: dn.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#8 Speed

Speed
  • Members
  • 87 posts

Posted 29 June 2020 - 01:18 AM

How you done it :) Did you really merged them, or just painted the colors?

No I wasn't able to merge them.  I used the Cell's Data property to store an Appointment ID.  Using the OnGetGridCell event, it checks to see if the Data property for the cell below it contains the same Appointment ID, if it does it paints the bottom edge the same colour, giving the appearance of the cells being one.

procedure TDayPlanner.GetGridCell(Sender: TObject; ACol, ARow: Integer; var Edges: TNxBorderEdges; State: TNxCellPaintingState);
var
   AppointmentID: integer;
begin
   if (ACol < FGrid.ColCount - 1) and
      (ARow < FGrid.RowCount - 1) then
   begin
      if (ACol = 0) and
         (FGrid.Cell[ACol, ARow].AsString <> '') then
      begin
         Edges[beBottom].Color := clWhite;
      end
      else if (ACol = 0) and
              (FGrid.Cell[ACol, ARow].AsString = '') then
      begin
         Edges[beTop].Color := clWhite;
      end
      // Is there a Appointment ID in this cell?
      else if Integer(FGrid.Cell[ACol, ARow].Data) > 0 then
      begin
         // Make sure we aren't at the bottom of the grid
         if (ARow + 1) < FGrid.RowCount - 1 then
         begin
            AppointmentID := integer(FGrid.Cell[ACol, ARow].Data);

            // Is the next cell also the same Appointment ID?
            if Integer(FGrid.Cell[ACol, ARow + 1].Data) = AppointmentID then
            begin
               Edges[beBottom].Color := FGrid.Cell[ACol, ARow].Color;
            end;
         end;
      end;
   end;
end;

= Steve






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users