TMSFMXTableView Right Rectangle Customization II

using D10 Seattle Enterprise

procedure TfrmTrack.TrackViewItemCustomize(Sender: TObject; AItem: TTMSFMXTableViewItem;
  AItemShape: TTMSFMXTableViewItemShape; AItemControlShape: TControl);
var
  panel: TRectangle;
  edt: TEdit;
begin
  panel := AItem.ShapeRightRectangle;
  if Assigned(panel) then
  begin
    panel.fill.Color := $FFF7F7F7;
   
    edt := TEdit.Create(panel);
    if Assigned(edt) then
    begin
      edt.Parent := panel;
      edt.Text := 'Lab';
      edt.Position.X := 1;
      edt.Position.Y := 1;
      edt.Size.Width := 25;
      edt.TextSettings.Font.Size := 20;
      edt.TextSettings.Font.Style := [TFontStyle.fsBold];
      edt.TextSettings.FontColor := TAlphaColorRec.Navy;
      edt.Canvas.Fill.Color := TAlphaColorRec.Red;
      edt.Visible := True;
      edt.BringToFront;
      edt.Repaint;
    end;
  end;
  panel.Repaint;
end;

I noticed that when I run the app and mouseover the right rectangle, when I'm in the vicinity of the TEdit the cursor changes to the edit box cursor. When I move off of the TEdit, the cursor changes back to the default arrow cursor. So it's definitely putting the edit box there.


I've tried calling control.BringToFront, Repaint etc. It's there, but it's not rendering properly. If I set the Rectangle Fill color to white, the rectangle appears as white, but nothing else is visible.

Is this some sort of rendering issue?

Hi, 


We have tested this here and can see the TEdit and the "Lab" text:


We are working on DX10 and update 1 installed. There are no difference made to the test code except for the initialization of the right rectangle:

  TMSFMXTableView1.ItemOptions := TMSFMXTableView1.ItemOptions + [ioRightRectangle];

Thanks. I had tried to solve this with the Style editor. Something in that config was causing the problem. Once I started over with a default style configuration it worked.


Thanks again.

I'm trying to color the AItem.ShapePlaceHolder rectangle on the TableViewEx Item. I'm not begin successful.


procedure TfrmTrack.TrackViewItemCustomize(Sender: TObject;
                                           AItem: TTMSFMXTableViewItem;
                                           AItemShape: TTMSFMXTableViewItemShape;
                                           AItemControlShape: TControl);
var
  panel: TRectangle;
begin
  panel := AItem.ShapePlaceHolder;
  if Assigned(panel) then
  begin
    panel.Size.Width := 28;
    panel.Fill.Color := TAlphaColorRec.Red;// FData.GetStatusColor(AItem.Tag,scResults);
  end;
end;

Should I expect this to work?
Thanks.

Hi, 


Can you try to set the panel.Fill.Kind to solid as well?

I tried this below, didn't work. I've reset the Style to default by deleting the stylebook, so their shouldn't be any style customization artifacts hanging around.

  panel := AItem.ShapePlaceHolder;
  if Assigned(panel) then
  begin
    panel.Size.Width := 28;
    panel.Fill.Kind := TBrushKind.Solid;
    panel.Fill.Color := TAlphaColorRec.Red;
  end;

Hi, 


What part of the item do you wish to style?
If you want to style the right rectangle you need to change the code to:

var
  panel: TRectangle;
begin
  panel := AItem.ShapeRightRectangle;
  if Assigned(panel) then
  begin
    panel.Size.Width := 28;
    panel.Fill.Kind := TBrushKind.Solid;
    panel.Fill.Color := TAlphaColorRec.Red;// FData.GetStatusColor(AItem.Tag,scResults);
  end;

I want to style both elements of the item, and possibly more! Is it reasonable to expect that I can style multiple elements of the item? 


I noticed that some elements (rectangles) have other items (images) in them. If I don't want to display the image, but instead want to, for example, draw text using for ex. an TTMSFMXHTMLText component, what do I do with the image that is by default in the rectangle? Can I get rid of it?

Are there elements in the item that I can't style?

Thanks.

Hi, 


You can simply set the Visible property to False of these elements. You can style every element in the TableView.

I've styled (in code) the ShapeRightRectangle. I have two issues that I hope you can help me with.


The detail rectangle with the > (arrow) pointing to the right shows up to the left of my ShapeRightRectangle. How can I have that show up on the right side of the ShapeRightRectangle?

One of the labels that I'm displaying inside of the ShapeRightRectangle is getting clipped on the bottom. How can I adjust the height of the tableviewitem /ShapeRightRectangle to be a little taller, or otherwise make adjustments so that the ShapeRightRectangle is not getting clipped on the bottom?

Thanks.

Hi, 


Each element is accessible through the OnItemCustomize, so you can simply use the Align, Position.X, Position.Y, Width and Height property of each object to position it to your likings.