Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > DB-Aware

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 05-14-2011, 11:04 PM
Moondancer Moondancer is offline
Junior Member
 
Join Date: Apr 2011
Posts: 22
Default 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 ?
Reply With Quote
  #2  
Old 05-15-2011, 03:36 AM
GeoWink GeoWink is offline
Senior Member
 
Join Date: Jan 2001
Posts: 885
Default

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;
Reply With Quote
  #3  
Old 05-16-2011, 01:25 AM
Moondancer Moondancer is offline
Junior Member
 
Join Date: Apr 2011
Posts: 22
Default

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.
Reply With Quote
  #4  
Old 05-16-2011, 03:04 PM
GeoWink GeoWink is offline
Senior Member
 
Join Date: Jan 2001
Posts: 885
Default

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
Reply With Quote
  #5  
Old 05-16-2011, 10:31 PM
Moondancer Moondancer is offline
Junior Member
 
Join Date: Apr 2011
Posts: 22
Default

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.
Reply With Quote
  #6  
Old 05-17-2011, 04:02 AM
GeoWink GeoWink is offline
Senior Member
 
Join Date: Jan 2001
Posts: 885
Default

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
Reply With Quote
  #7  
Old 05-25-2011, 10:25 AM
Saxosofon Saxosofon is offline
Junior Member
 
Join Date: May 2011
Location: Adamant
Posts: 1
Default

Thanks for posting that. It was a good educated guess on your part
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 08:17 PM.


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