Kramer_Gunter
(Softtouch Software Design)
February 28, 2017, 3:04pm
1
Is there any way to turn the focus rect off?
Is just does not look right to have a rectangle around a cell when rowselect is enabled.
Hi,
Yes you can use the following code to accomplish this:
procedure TForm1.FormCreate(Sender: TObject);
begin
TMSFMXGrid1.NeedStyleLookup;
TMSFMXGrid1.ApplyStyleLookup;
TMSFMXGrid1.SelectionMode := smSingleRow;
TMSFMXGrid1.GetDefaultFocusedLayout.Layout.Stroke.Kind := TBrushKind.None;
end;
Kramer_Gunter
(Softtouch Software Design)
March 16, 2017, 2:09am
3
Does not work for me.
I have smDisjunctRow enabled, and when clicking a row, this crazy dotted focus rect is back again. No clue why there is a focus rect around a cell when smSingleRow or smDisjunctgRow is enabled. In that case, the focus rect should be at least around the whole row.
The focus rect is there to know which cell is going to be edited when pressing F2 or Enter.
Can you try with the following code instead:
procedure TForm1.TMSFMXGrid1ApplyStyleLookup(Sender: TObject);
begin
TMSFMXGrid1.GetDefaultFocusedLayout.Layout.Stroke.Kind := TBrushKind.None;
end;
Kramer_Gunter
(Softtouch Software Design)
March 16, 2017, 9:28am
5
But if should not do that when the grid cannot be edited (read only for example).
The focus rect is there to know which cell is going to be edited when Can you try with the following code instead:
procedure TForm1.TMSFMXGrid1ApplyStyleLookup(Sender: TObject);
begin
TMSFMXGrid1.GetDefaultFocusedLayout.Layout.Stroke.Kind := TBrushKind.None;
end;
i will check that and will report back.