Delphi Pages Forums

Delphi Pages Forums (http://www.delphipages.com/forum/index.php)
-   DB-Aware (http://www.delphipages.com/forum/forumdisplay.php?f=5)
-   -   Abort/Cancel illegal operation in grid (http://www.delphipages.com/forum/showthread.php?t=210066)

Moondancer 05-14-2011 11:04 PM

Abort/Cancel illegal operation in grid
 
I have a strange issue...I am editing data in grid,before post I trigger:
If onefield.value > anotherfield.value then showmessage
I want to show the message and then abort the current operation.
Calling abort or table.cancel does not work.
what am I doing wrong ?

GeoWink 05-15-2011 03:36 AM

This works. Maybe use as an example?

George

procedure TForm1.ColorButton3Click(Sender: TObject);
var
I: integer;
X: integer;
begin
X := 0;
for I := 1 to 10 do
begin
X:= X + 1;
if X > 5 then
begin
OK_Box('This is GT 5');
Abort;
end
else
OK_Box('This is X =' + IntToStr(X));
end;
end;

Moondancer 05-16-2011 01:25 AM

I am editing inside the grid.So this is on the fly...
I want to alert before post that one value is higher than the other and that can not be.

GeoWink 05-16-2011 03:04 PM

The code I gave you can be put in anywhere. You must check something to know you are doing a post and that would be where the code goes. Not sure what the problem is. I have used a navigator with a grid and checked what was clicked on, such as a post, and that's where the code would go.

George

Moondancer 05-16-2011 10:31 PM

Using a button or editing in grid are 2 different things.
In grid, while editing, calling 'abort' would freeze editing entirely.
(I would have to use the navigators 'cancel' button to unlock
the record).'Cancel' has similar effect.
I do not want to cancel or freeze the editing of the record
after warning the user that he is trying to input an impossible equation.

GeoWink 05-17-2011 04:02 AM

I guess I look at this a whole different way. I personally would put the record in TEdits on a panel and let the user change whatever and check any of them. If there is a problem put up the message and refocus on the problem TEdit. Just the way I look at it.

George

Saxosofon 05-25-2011 10:25 AM

Thanks for posting that. It was a good educated guess on your part :)


All times are GMT. The time now is 07:42 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.