[Lazarus] latest revision breaks editor features!
Graeme Geldenhuys
graemeg.lists at gmail.com
Mon Jul 28 10:39:33 CEST 2008
Dave Coventry wrote:
> Hi,
>
> I'm sure this has been covered often, but none of my searches seems to find it.
>
> I have a routine to remove a row from a TStringGrid if the user selects it.
>
> The problem is that the onSelection event seems to be trigered twice:
>
>
> procedure TForm1.StringGrid1Selection(Sender: TObject; aCol, aRow: Integer);
> var i:integer;
> begin
> if messageDlg('Remove
> '+StringGrid1.Cells[aCol,aRow]+'?',mtInformation,[mbYes,mbNo],0)=mrYes
> then
> begin
> for i:=arow to StringGrid1.RowCount-2 do
> begin
> StringGrid1.Cells[0,i]:=StringGrid1.Cells[0,i+1];
> StringGrid1.Cells[1,i]:=StringGrid1.Cells[1,i+1];
> end;
> StringGrid1.RowCount:=StringGrid1.RowCount-1;
> end;
> end;
>
> The user will click the item to be removed, the dialog will appear
> asking for confirmation to delete the row, but on clicking yes, while
> the row is deleted as expected, the dialog pops up again, asking the
> user if the next line should be deleted.
> _______________________________________________
> Lazarus mailing list
> Lazarus at lazarus.freepascal.org
> http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
>
>
Out of your question
you can use
TStringGrid.DeleteColRow instead of your code
Salvatore
More information about the Lazarus
mailing list