Hi Friends...
I use Delphi 2010 application..
To do some calculation I load array of numbers into string grid but some times i have to make some of the rows inactive and do the calculations..Can any body help me out with a code to disable selected rows and do my work,,,
thanks in advance...

Recommended Answers

All 5 Replies

You can make whole string grid Disabled for Editing ....
Below is a small example how to change Enable/Disble Editing of the StringGrid1:

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Grids;

type
  TForm1 = class(TForm)
    StringGrid1: TStringGrid;
    CheckBox_StringGrid_Enable: TCheckBox;
    procedure CheckBox_StringGrid_EnableClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.CheckBox_StringGrid_EnableClick(Sender: TObject);
begin
  if CheckBox_StringGrid_Enable.Checked then
    StringGrid1.Options := [goFixedVertLine,goFixedHorzLine,goVertLine,goHorzLine,goRangeSelect,goEditing]
  else
    StringGrid1.Options := [goFixedVertLine,goFixedHorzLine,goVertLine,goHorzLine,goRangeSelect];
end;

end.

Thanks for the code that u sent... But is there any way that i can disable only a selected number of rows of my wish than disabling entire StringGrid data...

Thanks for the code that u sent... But is there any way that i can disable only a selected number of rows of my wish than disabling entire StringGrid data...

Your question is for Delphi 2010.
My answer above is for Delphi 7.
I hope that there is any way to disable only a selected number of rows of a StringGrid.

Can u send me the code if u know any such way of disabling selected rows in a String Grid... It will be very helpful for me if i get...
Thanks in advance..

Can u send me the code if u know any such way of disabling selected rows in a String Grid... It will be very helpful for me if i get...
Thanks in advance..

Sorry, I don't know any code for disabling selected rows in a String Grid ....

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.