View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0003373 | JEDI VCL | 00 JVCL Components | public | 2005-12-21 08:05 | 2006-01-24 02:04 |
Reporter | ivan_ra | Assigned To | AHUser | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Product Version | 3.00 | ||||
Target Version | Fixed in Version | 3.20 | |||
Summary | 0003373: TJvDBTreeView: change visibility again | ||||
Description | Issue http://homepages.borland.com/jedi/issuetracker/view.php?id=3256 corrects change visibility problem for TJvDBTreeView - now it can restore expanded end selected state after hiding. But this is one more small problem: TJvDBTreeView creates nodes dynamically - so, if TreeNode.HasChildren=true, in practice ChildCount can be 0 - they creates after expanding of node. So, if TJvDBTreeView has not yet expanding nodes (but HasChildren), after hiding and showing TJvDBTreeView looses information afout this nodes - they become empty. | ||||
Additional Information | This is solution for this case: we must save and restore TreeNode.HasChildren information in DestroyWnd and CreateWnd procedures: procedure TJvCustomDBTreeView.DestroyWnd; var Node: TTreeNode; temp:string; l:integer; HasChildren:byte; ///////////// NEW CODE begin if Items.Count > 0 then begin // save master values into stream FMastersStream:= TMemoryStream.Create; Node := Items.GetFirstNode; while Node <> nil do begin // save MasterValue as string temp:=VarToStr(TJvDBTreeNode(Node).MasterValue); l:=length(temp); FMastersStream.Write(l,SizeOf(l)); FMastersStream.Write(temp[1],l); HasChildren:=Byte(Node.HasChildren); /////////////// NEW FMastersStream.Write(HasChildren,1); /////////////// CODE Node := Node.GetNext; end; end; inherited DestroyWnd; end; procedure TJvCustomDBTreeView.CreateWnd; var Node: TTreeNode; temp:string; l:integer; HasChildren:byte; ///////////// NEW CODE begin inherited CreateWnd; // tree is restored. Now we must restore information about Master Values if assigned(FMastersStream) and (Items.Count > 0) then begin Node := Items.GetFirstNode; FMastersStream.Position:=0; while Node <> nil do begin FMastersStream.Read(l,SizeOf(l)); SetLength(temp,l); FMastersStream.Read(temp[1],l); TJvDBTreeNode(Node).SetMasterValue(temp); FMastersStream.Read(HasChildren,1); /////////////// NEW Node.HasChildren:=boolean(HasChildren); /////////////// CODE Node := Node.GetNext; end; FreeAndNil(FMastersStream); end; end; | ||||
Tags | No tags attached. | ||||
|
You can check this bug by hiding and showing not expanded TJvDBtreeView: if one of nodes has childs but not expanded, after hiding and showing of tree, this node looks as leaf (has not childs). After applying of shown code problem closes |
|
Fixed in CVS. |
Date Modified | Username | Field | Change |
---|---|---|---|
2005-12-21 08:05 | ivan_ra | New Issue | |
2006-01-23 08:26 | ivan_ra | Note Added: 0008426 | |
2006-01-24 02:04 | AHUser | Status | new => resolved |
2006-01-24 02:04 | AHUser | Resolution | open => fixed |
2006-01-24 02:04 | AHUser | Assigned To | => AHUser |
2006-01-24 02:04 | AHUser | Note Added: 0008436 |