Recent

Author Topic: TStringGrid options(Solved)  (Read 456 times)

JLWest

  • Hero Member
  • *****
  • Posts: 1293
TStringGrid options(Solved)
« on: December 15, 2022, 01:13:28 am »
Using the following statements to turn on editing in StringGrid2.
How wouild I turn editing off in code for StringGrid2?

Code: Pascal  [Select][+][-]
  1.  
  2. StringGrid2.AutoEdit:=True;
  3. if not (goEditing in StringGrid2.Options) then StringGrid2.Options := StringGrid2.Options + [goEditing];
  4.  
« Last Edit: December 15, 2022, 04:14:53 am by JLWest »
FPC 3.2.0, Lazarus IDE v2.0.4
 Windows 10 Pro 32-GB
 Intel i7 770K CPU 4.2GHz 32702MB Ram
GeForce GTX 1080 Graphics - 8 Gig
4.1 TB

jamie

  • Hero Member
  • *****
  • Posts: 6130
Re: TStringGrid options
« Reply #1 on: December 15, 2022, 01:19:32 am »
I use InClude and Exclude for those kinds of things.

But I think you can use the * in place of the + to remove it from the set
The only true wisdom is knowing you know nothing

KodeZwerg

  • Hero Member
  • *****
  • Posts: 2056
  • Fifty shades of code.
    • Delphi & FreePascal
Re: TStringGrid options
« Reply #2 on: December 15, 2022, 01:28:50 am »
How wouild I turn editing off in code for StringGrid2?
I do not know what you try to do but one answer would be:
Code: Pascal  [Select][+][-]
  1. procedure TForm1.StringGrid2EditingDone(Sender: TObject);
  2. begin
  3.   StringGrid2.AutoEdit := False;
  4. end;
« Last Edit: Tomorrow at 31:76:97 xm by KodeZwerg »

KodeZwerg

  • Hero Member
  • *****
  • Posts: 2056
  • Fifty shades of code.
    • Delphi & FreePascal
Re: TStringGrid options
« Reply #3 on: December 15, 2022, 01:37:22 am »
I do not know what you try to do but one answer would be:
Another answer could be:
Code: Pascal  [Select][+][-]
  1. procedure TForm1.StringGrid2EditingDone(Sender: TObject);
  2. begin
  3.   StringGrid2.Options := StringGrid2.Options - [goEditing];
  4. end;
« Last Edit: Tomorrow at 31:76:97 xm by KodeZwerg »

JLWest

  • Hero Member
  • *****
  • Posts: 1293
Re: TStringGrid options
« Reply #4 on: December 15, 2022, 01:54:54 am »
Thanks, I'' try these out.

I have two grids on a single form visible at all times.
Each grid can load multiple files.
Some files can not be edited while others can.

Therefore; depending on the file I'll turn editing on or off.
FPC 3.2.0, Lazarus IDE v2.0.4
 Windows 10 Pro 32-GB
 Intel i7 770K CPU 4.2GHz 32702MB Ram
GeForce GTX 1080 Graphics - 8 Gig
4.1 TB

KodeZwerg

  • Hero Member
  • *****
  • Posts: 2056
  • Fifty shades of code.
    • Delphi & FreePascal
Re: TStringGrid options
« Reply #5 on: December 15, 2022, 02:00:09 am »
I understand, than the more accurate way would be by reversing your code as follows:
Code: Pascal  [Select][+][-]
  1. if (goEditing in StringGrid2.Options) then StringGrid2.Options := StringGrid2.Options - [goEditing];
« Last Edit: Tomorrow at 31:76:97 xm by KodeZwerg »

 

TinyPortal © 2005-2018