View Issue Details

IDProjectCategoryView StatusLast Update
0002868JEDI VCL00 JVCL Componentspublic2006-01-26 00:52
Reporterbrethren70Assigned Toobones 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version3.00 
Target VersionFixed in Version3.20 
Summary0002868: JvDBTreeview with JvDock...Component raise exception "expression expected but nothing found"
Description1. form1 with JvDockserver
2. form2 with JvDockClient , JvDBTreeview with ClientDataSet
3. show form2.
4. It will be fine. it's normal.
3. dock form2 to form1.
4. it will show exception "expression expected but nothing found".

sorry for my poor English. :(
TagsNo tags attached.

Activities

obones

2005-04-14 06:48

administrator   ~0007003

Could you post a sample application, I have a hard time reproducing this.

brethren70

2005-04-14 23:41

reporter   ~0007010

Last edited: 2005-04-14 23:52

I can't upload a sample file. browser show "server not found" HTTP error.
So, I upload sample program in my server.

http://brethren70.cafe24.com/dev/bugreport/JvDBTreeview_BugReport.zip

I hope someone could upload the file to this issue tracker.

Thanks in advance.

DRothmaler

2005-04-15 03:37

reporter   ~0007011

Last edited: 2005-04-15 03:37

Could you please add the MenuTreeUnit pas/dfm-Fils to the zip...?

brethren70

2005-04-15 06:08

reporter   ~0007012

Sorry for my mistake.
I add the missing files to archive. :)

2005-04-17 22:25

 

JvDBTreeview_BugReport.zip (12,435 bytes)

obones

2005-04-18 07:05

administrator   ~0007023

Ok, here is a not so clean solution, but that's the best I can come up with, considering that TTreeNode.WriteData and TTreeNode.ReadData are private.
Anyway, add this in the protected section of the TJvCustoMDBTreeView interface:

    FSavedActive : Boolean;
    
    procedure CreateWnd; override;
    procedure DestroyWnd; override;

Then in the implementation section, add this:

procedure TJvCustomDBTreeView.CreateWnd;
begin
  inherited CreateWnd;
  if Assigned(FDataLink) and Assigned(FDataLink.DataSet) then
    FDataLink.DataSet.Active := FSavedActive;
end;

procedure TJvCustomDBTreeView.DestroyWnd;
begin
  if Assigned(FDataLink) and Assigned(FDataLink.DataSet) then
  begin
    FSavedActive := FDataLink.DataSet.Active;
    FDataLink.DataSet.Active := False;
  end;
  inherited DestroyWnd;
end;

Basically, the docking/undocking of the window means that it is destroyed and recreated. In order for the nodes to be valid, me make the dataset inactive. This might be a pain if it takes ages to make a dataset active.
That's why I'm NOT happy with that solution and am still trying to find a better way to do this.
Please let me know how this goes

brethren70

2005-04-19 06:54

reporter   ~0007028

Thanks, obones.

It works. Exception is gone.
But, I hope TJvDBTreeview can restore the state of treeview after docking.
Please, let me know if you can do it. :)

obones

2005-04-22 05:41

administrator   ~0007040

Well, that's the problem, because it gets recreated, it won't save it's current status. But I'll have a shot at it later on.

ivan_ra

2005-04-26 07:36

developer   ~0007068

TTreeNode.WriteData and TTreeNode.ReadData doesnt handle TJvDBTreeNode.FMasterValue. May be solution is to reproduce this private methods in JvDBTreeView module (with FMasterValue handling) and then override CreateWnd and DestroyWnd methods (in fact, reproduce them too)

obones

2005-04-26 07:41

administrator   ~0007069

I know, but the WriteData and ReadData are private, and so are the methods calling them. Thus it is very hard to override these and get them called.

ivan_ra

2005-04-26 07:57

developer   ~0007071

Not so hard, because they called only from virtual methods:
CreateWnd, DestroyWnd and Assign. TTreeNodes.DefineProperties use ReadData and WriteData, but it can use "inherited" methods.
So, may be enought to rewrite this list of methods:
TJvDBTreeNode.WriteDataNew - reproduce with FMasterValue handling;
TJvDBTreeNode.ReadDataNew - reproduce with FMasterValue handling;
TJvDBTreeView.CreateWnd - override;
TJvDBTreeView.DestroyWnd - override;
TJvDBTreeView.Assign - override;

ivan_ra

2005-04-26 08:33

developer   ~0007072

Last edited: 2005-04-27 06:54

Ok, may be it is really hard.
This is my solution (without closing and opening dataset):

  protected
  ...
    procedure CreateWnd; override; // ivan_ra
  ...

procedure TJvCustomDBTreeView.CreateWnd;
begin
  inherited CreateWnd;
  if not ValidDataSet or UpdateLocked then
    Exit;
  RefreshChild(nil); // UpdateTree;
  // and now select current record:
  SelectNode(FDataLink.DataSet.FieldByName(MasterField).AsVariant);
end;

function TJvCustomDBTreeView.CreateNode: TTreeNode;
begin
  Result := TJvDBTreeNode.Create(Items);
  TJvDBTreeNode(Result).FMasterValue:=null; // ivan_ra
end;

ivan_ra

2006-01-25 13:00

developer   ~0008455

This is closed by 0003373 and related topics

obones

2006-01-26 00:52

administrator   ~0008458

As indicated by ivan_ra, fixed by 0003373

Issue History

Date Modified Username Field Change
2005-04-13 08:50 brethren70 New Issue
2005-04-14 06:48 obones Note Added: 0007003
2005-04-14 06:48 obones Status new => feedback
2005-04-14 23:41 brethren70 Note Added: 0007010
2005-04-14 23:52 brethren70 Note Edited: 0007010
2005-04-15 03:37 DRothmaler Note Added: 0007011
2005-04-15 03:37 DRothmaler Note Edited: 0007011
2005-04-15 06:08 brethren70 Note Added: 0007012
2005-04-17 22:25 anonymous File Added: JvDBTreeview_BugReport.zip
2005-04-18 07:05 obones Note Added: 0007023
2005-04-19 06:54 brethren70 Note Added: 0007028
2005-04-22 05:41 obones Note Added: 0007040
2005-04-26 07:36 ivan_ra Note Added: 0007068
2005-04-26 07:41 obones Note Added: 0007069
2005-04-26 07:57 ivan_ra Note Added: 0007071
2005-04-26 08:33 ivan_ra Note Added: 0007072
2005-04-26 23:58 ivan_ra Note Edited: 0007072
2005-04-27 06:54 ivan_ra Note Edited: 0007072
2006-01-25 13:00 ivan_ra Note Added: 0008455
2006-01-26 00:52 obones Status feedback => resolved
2006-01-26 00:52 obones Resolution open => fixed
2006-01-26 00:52 obones Assigned To => obones
2006-01-26 00:52 obones Note Added: 0008458