Re:Master/Detail... stack overflow problem
Quote
Brian Bushay TeamB wrote:
> >After doing a modification in those data aware controls and moving to
> >another DBEdit, or clicking the Post button (i use another DBNavigator
> >with only Post and Cancel buttons visible, connected to Table2 as well),
> >I am getting a <Stack Overflow> error.
> Stack overflows are usually triggered when a piece of code is executed over and
> over again in an infinite recursion. Put some breakpoints into your code (the
> pushbuotton on click looks like a good place to start)
> If you step through your code you should be able to figure out what is going
> wrong
Brian,
there is no code actually i can step through!! When I am getting into
dsEdit state I move the focus to the 1st DBEdit control and disabling
the DBGrid2.
==========================
procedure TForm5ContactPerson.DBNavigator2Click(Sender: TObject;
Button: TNavigateBtn);
begin
if Button in [nbInsert,nbEdit] then
// check that Insert was successful
if DataModule2.Table2.State in [dsInsert,dsEdit] then begin
GroupBox1.Enabled:=False; //contains the master table DBGrid
GroupBox2.Enabled:=False; //contains the detail table DBGrid
GroupBox3.Enabled:=True; //contains the DBEdits (detail tbl)
DBEdit1.SetFocus;
end;
end;
==========================
When i edit something into that DBEdit and tabbing for the next DBEdit
(or clicking into it) I am getting stack overflow.
The same happens if i am in dsInsert mode. Here, as soon as i type the
first char into the DBEdit i am getting stack overflow immediately.
Is it possible, the fact that I have both a DBGrid and a set of DBEdit
controls connected to the same table, to be the source of the problem??
I tried using a different datasource to connect through it all the
DBEdits onto my detail table, but the same happened.
Is there a restriction on master/detail relationships and detail
table edit/insert? This is what i suspect.
To sum up, if i do the insert/edit using the DBGrid, then everything is
fine. But if do the insert/edit using the DBEdits then I am getting
stack overflow.
this is how i am posting or canceling changes. but it doesn't need for
this code to be executed, since the stack overflow happens even if i
am tabbing from the one DBEdit to the next,aften having type something.
==========================
procedure TForm5ContactPerson.DBNavigator3Click(Sender: TObject;
Button: TNavigateBtn);
begin
// on successful post or cancel do
if Datamodule2.Table2.State=dsBrowse then begin
GroupBox1.Enabled:=True;
GroupBox2.Enabled:=True;
DBGrid2.SetFocus;
GroupBox3.Enabled:=False;
end;
end;
==========================
thanks
Fotis