Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 10 of 15 total
Thread showed data no matching selected from from grid
Fri, Mar 24 2017 11:54 AMPermanent Link

Kees Lagendijk

Hi!

i'm having strange problems with opening records and showing data from a TDBGrid.

I'm using RAD studio Berlin 10.2 with latest DBISaM components

I have a mainform with a grid. the Grid is filled by a TDBIsamQuery
The query is simple "select * from Customers"

Double clicking the grid opens a new form with detailed information where a detailQuery is used
"select * from customers where Id=" <<selected row ID>>


Unil here al works fine.

However I'd like to use a overlayform to "blur out" the Mainform.

To do that i use a Unit called "Grayout" (ill add this unit as attachement). and opening and call the procecures in
the eventhandler:

ApplicationEvents1ModalBegin;
_GrayForms;

ApplicationEvents1ModalEnd;
_NormalForms;

So far so good.
Application runs smoothly, clicking the grid opens the detail form, shows the corresponding info and blurs out the MainForm.

Here is we're it gets weird.

When i close the detailForm and select a different row from the grid, the detailform pops up again but instead of showing the correct rowinfo, it shows the info from the first record on the grid??

Removing the procedures (_grayForms and _NormalForms) fixes the problem, but thats not the solutions i'm looking for.

I'm hoping anybody here can help me.

Kind regards









Kind regards



Attachments: GreyOut.pas
Fri, Mar 24 2017 1:57 PMPermanent Link

Fernando Dias

Team Elevate Team Elevate

Kees,

Can we see the code that is executed when a row is clicked, and the exact SQL of the queries, please?

--
Fernando Dias
[Team Elevate]
Fri, Mar 24 2017 11:15 PMPermanent Link

Raul

Team Elevate Team Elevate

<<
Here is we're it gets weird.

When i close the detailForm and select a different row from the grid, the detailform pops up again but instead of showing the correct rowinfo, it shows the info from the first record on the grid??

Removing the procedures (_grayForms and _NormalForms) fixes the problem, but thats not the solutions i'm looking for.

I'm hoping anybody here can help me.
>>

Few  additional questions :

- what exactly is modal form lifecycle (autocreated, created in code)

- show how modal form is called and ID passed (Fernando asked same already as well)

- what form events do you have tied to the forms - for example minimally what's fired is deactivate/activate on main form and show/hide on modal

Raul
Sat, Mar 25 2017 3:45 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Kees


This is a wild guess.

What you're doing is causing various windows to be recreated amongst them the dbgrid and this is causing it to end up in a confused state.

My first thought is to try a dbGrid.Refresh. If that doesn't work GetBookmark before opening the subsidiary form and GotoBookmark on closing it

I can't sensibly test anything out because I still use D2006

Roy Lambert
Mon, Mar 27 2017 8:45 AMPermanent Link

Kees Lagendijk

Here is the code that's executed in the OnDoubleClick of the TDBgrid on the mainForm

 if not Assigned(RelatieForm)
   then Application.CreateForm(TRelatieForm, RelatieForm);
 Relaties.SQL.Text:='select * from Relaties where relatieid='+IntToStr(Relaties['relatieID']);
 Relaties.Open;
 RelatieForm.ShowModal;

//(Relaties is a TDBisamQuery)

Few  additional questions :

- what exactly is modal form lifecycle (autocreated, created in code)
 

 KlantenToevoegMode := false;
 try
   Tables.RelatiesInfo.Post;
 except
 end;
 Relaties.Refresh;

- show how modal form is called and ID passed (Fernando asked same already as well)


- what form events do you have tied to the forms - for example minimally what's fired is deactivate/activate on main form and show/hide on modal

FormCreate:

 // Tell windows we accept file drops
 DragAcceptFiles(Self.Handle, True);

FormDestroy:

 // Cancel acceptance of file drops
 DragAcceptFiles(Self.Handle, false);

DetailFormClose

 KlantenToevoegMode := false;
 try
   Tables.RelatiesInfo.Post;
 except
 end;
Relaties.Refresh;

Hope this helps.

Thanks!
Mon, Mar 27 2017 9:44 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Kees


This line

 Relaties.SQL.Text:='select * from Relaties where relatieid='+IntToStr(Relaties['relatieID']);

baffles me. You have a query Relaties and something else called the same but I have no idea how Relaties['relatieID'] relates to the table displayed in the main forms dbgrid.

Add that to

DetailFormClose

 KlantenToevoegMode := false;
 try
   Tables.RelatiesInfo.Post;
 except
 end;
Relaties.Refresh; <<<<<<<<<<

which I think will reload the query and set the current row back to the top (since I don't have a recent version of DBISAM I can't check)

With the info posted so far its very difficult to pinpoint the problem. Can you post a demo project which shows the problem?

Roy Lambert
Mon, Mar 27 2017 10:37 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Kees,

<< I'm using RAD studio Berlin 10.2 with latest DBISaM components >>

They've made some modifications to the grids in later versions of Delphi that you have to be careful about.  One bug that we ran into was this:

http://www.elevatesoft.com/incident?action=viewrep&category=dbisam&release=4.41&incident=4183

So, if you can distill the issue down into a sample project, I'll be more than happy to take a look and see what I can figure out in terms of a possible fix in DBISAM.  But, I can't make any guarantees, especially if the issue is in the Embarcadero code.

Just email me the project at timyoung@elevatesoft.com. (.zip please).

Tim Young
Elevate Software
www.elevatesoft.com
Mon, Mar 27 2017 11:17 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Tim


Did they ever fix the column 0 problem?

Roy Lambert
Wed, Mar 29 2017 6:13 AMPermanent Link

Kees Lagendijk

Hi Roy,

That baffled me too Smile

I should be this:

 if not Assigned(RelatieForm)
   then Application.CreateForm(TRelatieForm, RelatieForm);

>>>> OpenVelden('*','RelatiesEdit','Relaties','inner join relatiesAdres on relatiesAdres.relatieiD=relaties.relatieID >>>>  where relatieid='+IntToStr(Tables.Relaties['relatieID']));
 
RelatieForm.ShowModal;



procedure OpenVelden(const SQL,Query,Tabel,Params:string);
var
 Found: Boolean;
 i: integer;
 TempComp: TComponent;
 s: string;
begin
 Found := False;
 with Tables do
 begin
   for i := 0 to ComponentCount - 1 do
     begin
       if LowerCase(Components[i].Name) = LowerCase(Query) then
         begin
           TempComp := Components[i];
           Found := (TempComp is TDBISAMQuery);
         end;
       if Found then break;
     end;
   if TempComp is TDBISAMQuery then
     begin
       s:='select '+SQL+' from '+Tabel+' '+params;
       //showmessage(s);
       (TempComp as TDBISAMQuery).Close;
       (TempComp as TDBISAMQuery).SQL.Text:='select '+SQL+' from '+Tabel+' '+params;
       (TempComp as TDBISAMQuery).Open;
     end;
 end;
end;
Thu, Mar 30 2017 11:26 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Roy,

<< Did they ever fix the column 0 problem? >>

I'm not familiar with that one. (?)

Tim Young
Elevate Software
www.elevatesoft.com
Page 1 of 2Next Page »
Jump to Page:  1 2
Image