Recent

Author Topic: [SOLVED] StringGrid hide selection?  (Read 2308 times)

SunyD

  • Guest
[SOLVED] StringGrid hide selection?
« on: March 28, 2017, 11:45:08 am »
Hello,
is there an option to hide of selection in stringgrid, like the option dgAlwaysShowSelection in TDBGrid ?

If no, maybe we can add the option goAlwaysShowSelection to TStringGrid. In TDBGrid it is a few lines of code.
« Last Edit: March 28, 2017, 12:27:55 pm by Soner A. »

SunyD

  • Guest
Re: StringGrid hide selection?
« Reply #1 on: March 28, 2017, 12:26:45 pm »
I made modifications in Grids.pas if anyone wants here is it:
Code: Pascal  [Select][+][-]
  1. //TGridOptions have already 32x enums so added new Property AlwaysShowSelection
  2. //dgAlwaysShowSelection can be removed from TDBGrid.Options because it has same effect.
  3.   TCustomGrid=class(TCustomControl)
  4.   private
  5.     fAlwaysShowSelection : Boolean; //soner added
  6.   published
  7.     property AlwaysShowSelection : Boolean read fAlwaysShowSelection write fAlwaysShowSelection; //soner added
  8.   end;
  9.  
  10.  
  11. procedure TCustomGrid.GetSelectedState(AState: TGridDrawState; out
  12.   IsSelected: boolean);
  13. begin
  14.   IsSelected := (gdSelected in aState)
  15.       and (fAlwaysShowSelection or Self.Focused); //soner added  
  16.  //..
  17. end.
  18.  

 

TinyPortal © 2005-2018