[Openroad-users] Setting focus on a duplicated treeview
jade clements
jade.clements at myworkplace.com.au
Mon Oct 29 10:52:26 EST 2007
Hi All,
I've two treeviewfields. One that is loaded and one that is a copy of the
first. I've used Sean Throwers example provided on 23 July 2007 (see below)
to load the 2nd treeview which works (Thanks Sean) however, I cannot set the
focus back to the top of the treeview, it always stays at the bottom of the
tree. I've tried using the 'isExpanded' and 'isSelected' when ct = 1
(highlighted in blue below). I've even tried traversing through the 2nd
tree yet still no success.
Does anyone know how to set the focus back to the top of the new tree after
loading it?
ON CLICK copybtn =
DECLARE
oldTvf = TreeViewField DEFAULT NULL;
newTvf = TreeViewField DEFAULT NULL;
ct = integer NOT NULL;
entry = integer NOT NULL;
rc = integer NOT NULL;
oldNode = TreeNode DEFAULT NULL;
newNode = TreeNode DEFAULT NULL;
oldRelative = TreeNode DEFAULT NULL;
newRelative = TreeNode DEFAULT NULL;
oldNodes = ARRAY OF TreeNode;
newNodes = ARRAY OF TreeNode;
ENDDECLARE
BEGIN
/*
** Set references
*/
oldTvf = FIELD(oldOakTree);
newTvf = FIELD(newOakTree);
/*
** Copy the imagelist
*/
FOR ct = 1 TO oldTvf.ImageList.LastRow DO
newTvf.ImageList[ct] = oldTvf.ImageList[ct].Duplicate();
ENDFOR;
/*
** Build the tree
*/
oldTvf.Tree.StartTraverse();
FOR ct = 1 TO oldTvf.Tree.Nodes DO
/*
** Get the next "old" node
*/
oldNode = oldTvf.Tree.NextNode();
/*
** Identify the "new" parentnode corresponding to the old one
*/
IF oldNode.ParentNode = oldRelative THEN
/*na*/;
ELSE
rc = oldNodes.Find('instanceidentifier',
value=oldNode.ParentNode.InstanceIdentifier,
rowNumber=Byref(entry));
oldRelative = oldNodes[entry];
newRelative = newNodes[entry];
ENDIF;
/*
** Create the new node and populate it
*/
newNode = newTvf.Tree.AddNode( relative=newRelative;
name=oldNode.TextLabel);
newNode.SetAttribute(
selBmpLblIndx=oldNode.selBmpLblIndx;
//. etc for each not-yet-set writable treenode attribute, eg
IsExpanded;
bmpLblIndx=oldNode.BmpLblIndx
);
if ct = 1 then
newNode.isSelected = 1;
newNode.Expanded = 1;
endif;
/*
** Add old and new node to lists for subsequent parentnode matching
*/
oldNodes[oldNodes.LastRow+1] = oldNode;
newNodes[newNodes.LastRow+1] = newNode;
ENDFOR;
/*
** Clean up
*/
oldTvf.Tree.StopTraverse();
newTvf.UpdField(0);
END;
Regards
Jade Clements
MyWorkplace Solutions Pty Limited
Level 5, 11 Queens Road
Melbourne Victoria 3004
Ph: 1300 733 731
Making Service our Priority
www.MyWorkplace.com.au
If you receive this email by mistake, please notify us and do not make any
use of the email. We do not waive any privilege, confidentiality or
copyright associated with it.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.peerlessit.com/pipermail/openroad-users/attachments/20071029/ddbffc80/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/jpeg
Size: 1436 bytes
Desc: not available
Url : http://www.peerlessit.com/pipermail/openroad-users/attachments/20071029/ddbffc80/attachment.jpe
More information about the Openroad-users
mailing list