Project JEDI - Issue Tracker
Mantis Bugtracker

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0002868 [JEDI VCL] 00 JVCL Components minor always 2005-04-13 08:50 2006-01-26 00:52
Reporter brethren70 View Status public  
Assigned To obones
Priority normal Resolution fixed  
Status resolved   Product Version 3.00
Summary 0002868: JvDBTreeview with JvDock...Component raise exception "expression expected but nothing found"
Description 1. 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. :(
Additional Information
Tags No tags attached.
Attached Files zip file icon JvDBTreeview_BugReport.zip [^] (12,435 bytes) 2005-04-17 22:25

- Relationships

-  Notes
(0007003)
obones (administrator)
2005-04-14 06:48

Could you post a sample application, I have a hard time reproducing this.
(0007010)
brethren70 (reporter)
2005-04-14 23:41
edited on: 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.

(0007011)
DRothmaler (reporter)
2005-04-15 03:37
edited on: 2005-04-15 03:37

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

(0007012)
brethren70 (reporter)
2005-04-15 06:08

Sorry for my mistake.
I add the missing files to archive. :)
(0007023)
obones (administrator)
2005-04-18 07:05

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
(0007028)
brethren70 (reporter)
2005-04-19 06:54

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. :)
(0007040)
obones (administrator)
2005-04-22 05:41

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.
(0007068)
ivan_ra (developer)
2005-04-26 07:36

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)
(0007069)
obones (administrator)
2005-04-26 07:41

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.
(0007071)
ivan_ra (developer)
2005-04-26 07:57

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;
(0007072)
ivan_ra (developer)
2005-04-26 08:33
edited on: 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;

(0008455)
ivan_ra (developer)
2006-01-25 13:00

This is closed by 0003373 and related topics
(0008458)
obones (administrator)
2006-01-26 00:52

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 04:46 DRothmaler Issue Monitored: DRothmaler
2005-04-14 06:48 obones Note Added: 0007003
2005-04-14 06:48 obones Status new => feedback
2005-04-14 23:27 brethren70 Note Added: 0007009
2005-04-14 23:29 brethren70 Issue Monitored: brethren70
2005-04-14 23:29 brethren70 Note Deleted: 0007009
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


Mantis 1.1.6[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker