Recent

Author Topic: VirtualTreeView what simple way to edit RootNode  (Read 8076 times)

Shebuka

  • Sr. Member
  • ****
  • Posts: 429
VirtualTreeView what simple way to edit RootNode
« on: July 01, 2011, 12:40:10 pm »
Hi,
I have a tree with no columns, only 2 levels (root and a child of root) and i need to rename the root node and i can't come out on how to convalidate the editing.

On popup click i take the first selected root node and call VST_UserContacts.EditNode(Node, -1);
In VST_UserContactsEditing i assign Allowed := True; (because user can't 'click edit' the nodes, only from popup).

Then i don't know how to get the edited text and assign it to the data record (it has RootNode, Name and Status fileds) associated with the node. Con you help me?

p.s. I'v seen the demo, but it seems to be too complicated for my use, i don't need stringpick, combobox, memo or data calendar, only edit a generic string.

LuizAmérico

  • Sr. Member
  • ****
  • Posts: 457
Re: VirtualTreeView what simple way to edit RootNode
« Reply #1 on: July 04, 2011, 10:34:42 pm »
Unfortunately VirtualTreeView has an steep learn curve

So my advices:

- Read the docs http://www.soft-gems.net/index.php?option=com_content&task=view&id=30&Itemid=35

- Study the demos

- Search in the net

IPguy

  • Sr. Member
  • ****
  • Posts: 385
Re: VirtualTreeView what simple way to edit RootNode
« Reply #2 on: July 08, 2011, 02:47:41 am »
Shebuka,
As I do not have your code, I'm going to guess at what you are attempting to do.

In general:
- Get the node id of the node you want to edit  "Node"
- get the data handle associated with it "Data"
- set the individual data fields from the user edited field or entry method.

Code: [Select]
Procedure TfSNMPGet.vstContextPopup( ....
var
  Node : pVirtualNode;
  Data : pDevTreeData;     
begin ...
  // this returns the node under the cursor
  Node := vst.GetNodeAt(MousePos.X, MousePos.Y);   

  // This gets the data structure associated with the above node
  Data := vst.GetNodeData(Node); 

  Data.Column0 := Edit1.Text;  //  This might have to be ...Data^.C....

end;

 

TinyPortal © 2005-2018