Skocz do zawartości

Problem z Gridem


Henryk555

Polecane posty

var

Form1: TForm1;

a,b:byte;

Counter:byte;

implementation

 

{$R *.dfm}

 

procedure TForm1.FormCreate(Sender: TObject);

begin

for a := 0 to 7 do

for b := 0 to 7 do

begin

SG.Cells[a,b]:=' ';

SG.Cells[3,0]:='X';

SG.Cells[5,0]:='X';

SG.Cells[7,0]:='X';

end;

end;

 

procedure TForm1.SpeedButton1Click(Sender: TObject);

begin

for a := 0 to 7 do

for b := 0 to 7 do

begin

if SG.Cells[a,b] = ' ' then Counter := Counter + 1;

Label1.Caption:= 'Empty cells ='+' '+inttostr(Counter); //Show me = 61 empty cells

//Counting well all empty cells in stringgrid (total rows and cols) , but my problem is other...

//In first row of Grid we have 2 times 'X' and I wanna to count row by this way:

// 3X1X2

// 3 = 3 empty cells

// X = 1 'separator' (write as char found in cell. It may be 'A','Z' uppercase or lowercase)

// 1 = empty cell

// X = 1 'separator' (write as char found in cell. It may be 'A','Z' uppercase or lowercase)

// 2 = 2 empty cells (where 'separator' means <> ' ' (Space))

// each row should be add to a ListBox ... how to do it?

//Let me mention, that in Grid I will change empty cells and 'separators'

//then everytime program has to count different positions in every row ...

end;

end;

 

end.

Link do komentarza
Udostępnij na innych stronach

Zarchiwizowany

Ten temat jest archiwizowany i nie można dodawać nowych odpowiedzi.

×
×
  • Utwórz nowe...