Henryk555 Napisano Luty 20, 2014 Zgłoś Share Napisano Luty 20, 2014 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 More sharing options...
babubabu Napisano Luty 20, 2014 Zgłoś Share Napisano Luty 20, 2014 ;] Link do komentarza Udostępnij na innych stronach More sharing options...
olesio Napisano Luty 21, 2014 Zgłoś Share Napisano Luty 21, 2014 Kod niesformatowany, nie został wklejony w odpowiednie znaczniki. I nie opisano, z tego co (nie) widzę w czym problem. Ogarnij to jeżeli chcesz żeby ktoś pomógł. Pozdrawiam: olesio Link do komentarza Udostępnij na innych stronach More sharing options...
Polecane posty
Zarchiwizowany
Ten temat jest archiwizowany i nie można dodawać nowych odpowiedzi.