Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TNodeDictionary (generic Tree dictionary) #2

Open
davidberneda opened this issue Jun 15, 2015 · 1 comment
Open

TNodeDictionary (generic Tree dictionary) #2

davidberneda opened this issue Jun 15, 2015 · 1 comment

Comments

@davidberneda
Copy link
Owner

It is currently possible to create a Tree of dictionary nodes, for example:

uses
   System.Generic.Collections;

type
  TMyTree = TNode<TDictionary<String, TButton>>;

In this way, each node "Data" property is a TDictionary that can be used as normal.

However, this is different than having a Tree structure where the children nodes are unique, and accessible using the desired "Key", for example.

type
  TMyTree = TNodeDictionary<String, Integer>;

var 
  Root : TMyTree;
...
  Root['America'].Data := 123;
  Root['America']['USA'].Data := 456;

In the above code, "USA" is a unique children node of "America", and each node has a "Data" property of type Integer.

@edwinyzh
Copy link

A nice idea idea, now it looks like a JSON object 😄

Can we also do Root['America']['USA']['3rdLevel'].Data := 456; ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants