Board index » delphi » Navigator Post click before entered on cell?

Navigator Post click before entered on cell?

Hi,
The user clicks the navigator Add button.
Then enters the data in the DBGrid, but clicks the Navigator Post
button before pressing Enter in the last cell of the DBGrid edited.
Result : Stack Overflow
If the user presses Enter before posting, there is no problem.
How can I prevent this stack overflow?
Thank you
Regards
Johan Smit
 

Re:Navigator Post click before entered on cell?


Try setting DBGrid1.Options.dgCancelOnExit to False.

"Johan Smit" <smi...@mweb.co.za> schreef in bericht
news:3a012ae4.15619442@news.mweb.co.za...

Quote
> Hi,
> The user clicks the navigator Add button.
> Then enters the data in the DBGrid, but clicks the Navigator Post
> button before pressing Enter in the last cell of the DBGrid edited.
> Result : Stack Overflow
> If the user presses Enter before posting, there is no problem.
> How can I prevent this stack overflow?
> Thank you
> Regards
> Johan Smit

Re:Navigator Post click before entered on cell?


On Thu, 2 Nov 2000 10:02:11 +0100, "M.H. Avegaart"

Quote
<avegaartNOS...@mccomm.nl> wrote:
>Try setting DBGrid1.Options.dgCancelOnExit to False.

Hi,
After looking at that property, I found the problem.
It was my own lack of insight.
I wanted to set the focus back to a DBGrid cell after posting ,so I
added:
procedure Tfrm1.DS1DataChange(Sender: TObject; Field: TField);
begin
  DBGrid1.SetFocus;
  DBGrid1.SelectedField := DBGrid1.Fields[3];
end;
Now that caused an endless loop, the DS1DataChange is called
recursively until stack overflow.
Moving the code to T1.AfterPost cleared it.
A frustrating and unnecessary excersize!
Thank you for your reply.
Best Regards

Other Threads