Forum > LCL

[SOLVED] How to stay in the invalid cell in Event TStringGrid_OnEditingDone?

<< < (3/3)

egsuh:


--- Quote ---Apparently, if you want to use the OValidate event, all one needs to do to reject the cell's contents and stay in place is simply all the "Abort" while in that event.
--- End quote ---

Yes, this seems the neatest way. If exception is raised, there is an error message popup anyway.
Following seems the final. Thank you for your advice.


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TForm1.StringGrid1ValidateEntry(Sender: TObject; aCol, aRow: Integer;  const OldValue: string; var NewValue: String);begin   if (NewValue <> '') and (StrtoIntDef(NewValue, -1) = -1) then begin      ShowMessage('Only numeric values');      NewValue := OldValue;      Abort;      // raise Exception.Create('Only numeric values in column 1');   end;end; 

Navigation

[0] Message Index

[*] Previous page

Go to full version