Link to home
Start Free TrialLog in
Avatar of shrldu
shrldu

asked on

DBGrid is inactive after adding a record (Delphi 1)

I add a record to a Table. After returning from edit form to the form where is a DBGrid which displays that table the DBGrid is inactive. I cannot move the pointer, I cannot choose any record. If I click on any other table control (let's say the control which displays memo from the same table), DBGrid gets active again.
This strange behaviour is observed only when the number of records is greater than the number of rows in the DBGrid.
There is a query set on that table (I use Luxent Apollo database engine), but I do not know if that is relevant.
Avatar of shrldu
shrldu

ASKER

Adjusted points to 200
? Can you display some code?
Do you deactivate the table when you go out of that window?
? More information is always welcome...
Avatar of shrldu

ASKER

The code is as follows:

FormUchwaly.Enabled := False;   { first form }
Screen.Cursor := crHourglass;
FormEdUchwaly := TFormEdUchwaly.Create(Application);   { second form, where I do edition with  Insert  or Edit, then I post)
Screen.Cursor := crDefault;;
FormEdUchwaly.ShowModal;
FormEdUchwaly.Free;
FormUchwaly.Enabled := True;
FormUchwaly.Show;
FormUchwaly.Refresh;
{Apollo query is set on the table which is connected with the grid below}
DBGridUchwaly.Refresh;   {DBGrid which makes the trouble}

I deactivate the table connected to DBGridUchwaly only when I close the first form, FormUchwaly.

I don't really know, but I don't think it's necessary to deactivate your first form (it happens automatically). You use also showmodal that automatically only let keyboard input to that form, you have to close this form before you can continue) So you can leave
 FormUchwaly.Enabled := false
 FormUchWaly.Enabled := True
 FormUchWaly.Show;

out of your code.

 FormUchWaly.Refresh needed?

(Don't think this has something to do with your problem, but who knows?)

 What does Apollo does when it activates a query?

I'm sorry, but this is the only way I see I could help you (just proposing some things & asking questions)

Give a sign...
Avatar of shrldu

ASKER

It's amazing, but when I deleted:
FormUchwaly.Enabled := false
and
FormUchWaly.Enabled := True
my problem disappeared!
So I undestand that you solved my problem. But why on the earth it behaves like this? Do you have any comment on this?  Anyway, just put it as your anwer and I will accept your response.
Thank you very much for your help!
Greetings from a physicist to a physicist <G>.
ASKER CERTIFIED SOLUTION
Avatar of ZifNab
ZifNab

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial