Tree views and tag info
Tree views and tag info
I'm trying to get together a basic map file loader, and here's what I have so far:
reads headers and tags
loads them into a list box
opens ce or pc
However, I cant figure out how to put the tags into a tree view.
Im loading the tags by doing a loop where it reads one tag each time around, setting variables for the tag classes, meta offsets, name, etc., and i put the tags into the listbox by simply telling it to add the primary tagclass and name at the end of each loop.
Am i on the right track to putting them into a tree view?
Also, I'm not sure how to store the information from each tag. What I'm looking for is this: loading the tags into a tree view, then when you click on one, it displays some of the info i read earlier, like the classes, offsets, and such
I'm using vb, but you don't need to give me code, just the idea of what to do
here's what i have so far:
Any help is much appreciated!
reads headers and tags
loads them into a list box
opens ce or pc
However, I cant figure out how to put the tags into a tree view.
Im loading the tags by doing a loop where it reads one tag each time around, setting variables for the tag classes, meta offsets, name, etc., and i put the tags into the listbox by simply telling it to add the primary tagclass and name at the end of each loop.
Am i on the right track to putting them into a tree view?
Also, I'm not sure how to store the information from each tag. What I'm looking for is this: loading the tags into a tree view, then when you click on one, it displays some of the info i read earlier, like the classes, offsets, and such
I'm using vb, but you don't need to give me code, just the idea of what to do
here's what i have so far:
Any help is much appreciated!
conure says: or i could jsut incase my shoes in papar mache, followed by my dog
|||Lethargy||| Mr. Mohawk|||
|||feel free to contact me via PMs, AIM, MSNM, or Xfire if you have any questions|||
- grimdoomer
- Posts: 1440
- Joined: Mon Oct 09, 2006 4:36 pm
well if you add them to a treeview, you willl have that entire line the offset, tag class, and path. What you should dp is make it like tag classes then you exspand them and there are all the tags of that class.
AI Zones in MP | Ambiance | Gravemind Beta v1.1
Aumaan Anubis wrote:Grimdoomer. The first person ever to mod Halo 2 Vista.
yes, but how? I have never used tree views beforegrimdoomer wrote:well if you add them to a treeview, you willl have that entire line the offset, tag class, and path. What you should dp is make it like tag classes then you exspand them and there are all the tags of that class.
conure says: or i could jsut incase my shoes in papar mache, followed by my dog
|||Lethargy||| Mr. Mohawk|||
|||feel free to contact me via PMs, AIM, MSNM, or Xfire if you have any questions|||
-
- Posts: 5426
- Joined: Sat Jul 24, 2004 12:12 pm
- Location: I'm a Paranoid
- Contact:
thats pretty much it >_>Patrickssj6 wrote:Wait, you just cracked the magic of Halo maps...but you don't know how to populate a tree view? xD
No sorry, that's irony.
so do you know how? you're good at vb, if i send you my source could you look at my method for loading the map and then determine a way to load it into a tree view?
conure says: or i could jsut incase my shoes in papar mache, followed by my dog
|||Lethargy||| Mr. Mohawk|||
|||feel free to contact me via PMs, AIM, MSNM, or Xfire if you have any questions|||
- grimdoomer
- Posts: 1440
- Joined: Mon Oct 09, 2006 4:36 pm
ill help you but only on aim.
AI Zones in MP | Ambiance | Gravemind Beta v1.1
Aumaan Anubis wrote:Grimdoomer. The first person ever to mod Halo 2 Vista.
Halomods is not good enough?..grimdoomer wrote:ill help you but only on aim.
Anyway, Treeviews are easy. Just loop through the main classes, make a node for each, loop through the tags, add the tag if it's of the same class, repeat..
Halo 2 Prophet - Skin with ease with the simple 3D point and click interface.
Halo 3 Research Thread - Contribute to the research into Halo 3.
Halo 3 Research Thread - Contribute to the research into Halo 3.
thanks for the link, prey. I was able to figure it out from there
Onward to my next problem: being able to click on a tag and retrieve it's attributes. would i create some sort of arraylist and then add to it as I loop through the tags? Once again, I'm a beginner programmer and could use some examples. Thanks for the help!
Onward to my next problem: being able to click on a tag and retrieve it's attributes. would i create some sort of arraylist and then add to it as I loop through the tags? Once again, I'm a beginner programmer and could use some examples. Thanks for the help!
conure says: or i could jsut incase my shoes in papar mache, followed by my dog
|||Lethargy||| Mr. Mohawk|||
|||feel free to contact me via PMs, AIM, MSNM, or Xfire if you have any questions|||
- grimdoomer
- Posts: 1440
- Joined: Mon Oct 09, 2006 4:36 pm
create a TreeView1_AfterSelect meathod then, you can get the tag path by doing Me.TreeView1.SelectedNodes.Text
AI Zones in MP | Ambiance | Gravemind Beta v1.1
Aumaan Anubis wrote:Grimdoomer. The first person ever to mod Halo 2 Vista.
I know how to do that, but that can only return the tag's name. what I'm looking for is this:
when loading the tags, for each tag, I found some info, like the classes, meta offsets, etc. I want to be able to retrieve that info when I click on a tag... so I click on the warthog's tag and I can display it's meta offset in a textbox or something.
when loading the tags, for each tag, I found some info, like the classes, meta offsets, etc. I want to be able to retrieve that info when I click on a tag... so I click on the warthog's tag and I can display it's meta offset in a textbox or something.
conure says: or i could jsut incase my shoes in papar mache, followed by my dog
|||Lethargy||| Mr. Mohawk|||
|||feel free to contact me via PMs, AIM, MSNM, or Xfire if you have any questions|||
- grimdoomer
- Posts: 1440
- Joined: Mon Oct 09, 2006 4:36 pm
create a function and add this once you read it you will be able to make others,
basicly if h2Tag.w/e = H2Tag.w/e Then you can read the info you want cus you now have that tag.
Code: Select all
Public Function FindTagIndexByPath(ByVal TagPath As String) As Integer
Dim TagIndex As Integer = 0
'Loop through all the tags and if we find a matching path then we return then index of it
For i As Integer = 1 To ObjectCount Step 1
If H2Tag(i).TagPath = TagPath Then
TagIndex = i
Exit For
End If
Next
Return TagIndex
End Function
AI Zones in MP | Ambiance | Gravemind Beta v1.1
Aumaan Anubis wrote:Grimdoomer. The first person ever to mod Halo 2 Vista.
the problem, though, is that the warthog's collision, model, physics, vehi, etc., all share the same name... that would definately lead to inaccuracies. That also seems like it would work really slowly.
conure says: or i could jsut incase my shoes in papar mache, followed by my dog
|||Lethargy||| Mr. Mohawk|||
|||feel free to contact me via PMs, AIM, MSNM, or Xfire if you have any questions|||
There's always the lazy way of using a hidden column (or if the language has a built in hidden value for a given item use that) with the array index of the data for the given tag. I find that to be the simplest solution even if it does feel like cheating.
Edit: found the hidden associator: control.tag. If you can use that on a per listbox.item basis that'd be my recommendation.
P.S. why would you use a loop? It's faster to use objects like dictionary or hashtable isn't it?
Edit: found the hidden associator: control.tag. If you can use that on a per listbox.item basis that'd be my recommendation.
P.S. why would you use a loop? It's faster to use objects like dictionary or hashtable isn't it?
Those are faster I think, and easy to program with too, another solution that I used is a custom generic TreeNode<T> class that has an Item of type T, and I made the Type be Tag.Altimit01 wrote:P.S. why would you use a loop? It's faster to use objects like dictionary or hashtable isn't it?
thanks for the help everyone! I figured out a method. I created a hash table called MetaOffsetStorage. Then, While I'm looping through tags (only only ever loop once), for each tag, I create a key/value pair. I set the key to be the title of the branch i stuck that tag in plus "\" and then the name of the tag. Then I set the value to be Hex$(offset) (the number that HMT shows you when you do meta swaps). Then when you click on a tag, it returns it's path, which is the same as what i set the key to be, so I can easily retrieve it's corresponding value. Also, by adding the primary class to the beginning of the key, it prevent name duplicates like i mentioned earlier. It's probably a little unorthodox, but it works. Thanks for the help!
Removed double post.
Removed double post.
conure says: or i could jsut incase my shoes in papar mache, followed by my dog
|||Lethargy||| Mr. Mohawk|||
|||feel free to contact me via PMs, AIM, MSNM, or Xfire if you have any questions|||
- Cryticfarm
- Posts: 3611
- Joined: Sat Dec 09, 2006 7:23 pm
- Location: canada
- Contact:
Quick question:
I have a node selected in a tree view. it's key is... key. I want to add that node and every other node within that parent to a combobox.
I tried:
ComboBox1.Items.Add(tv.SelectedNode.Parent.Nodes)
But it just prints "(Collection)"
Thanks in advance
I have a node selected in a tree view. it's key is... key. I want to add that node and every other node within that parent to a combobox.
I tried:
ComboBox1.Items.Add(tv.SelectedNode.Parent.Nodes)
But it just prints "(Collection)"
Thanks in advance
conure says: or i could jsut incase my shoes in papar mache, followed by my dog
|||Lethargy||| Mr. Mohawk|||
|||feel free to contact me via PMs, AIM, MSNM, or Xfire if you have any questions|||
Code: Select all
For i as integer = 0 to treeView1.SelectedNode.Parent.Nodes.Count - 1
ComboBox1.Items.Add(treeView1.SelectedNode.Parent.Nodes(i).Text
Next
Also you said some tags have different classes... Why not edit the above function to check classes aswell? Here I did it for you.
Code: Select all
Public Function FindTagIndexByPath(ByVal TagClass As String, ByVal TagPath As String) As Integer
Dim TagIndex As Integer = 0
'Loop through all the tags and if we find a matching path then we return then index of it
For i As Integer = 1 To ObjectCount Step 1
If H2Tag(i).TagPath = TagPath Then
If H2Tag(i).TagClass = TagClass Then
TagIndex = i
Exit For
End If
End If
Next
Return TagIndex
End Function
Missed out a bracket.. :Z-DeToX- wrote:[...]
Should take care of it for you.
Code: Select all
For i as integer = 0 to treeView1.SelectedNode.Parent.Nodes.Count - 1
ComboBox1.Items.Add(treeView1.SelectedNode.Parent.Nodes(i).Text)
Next
Meh I would swap the checks around, as comparing 4 chars against 4 chars first would be less memory intensive, opposed to comparing variable sized strings to each other that is. Also why the two if commands.. =x-DeToX- wrote:Also you said some tags have different classes... Why not edit the above function to check classes aswell? Here I did it for you.
[...]
And grimdoomer, initialising the TagIndex to 0 is a bad idea, because if no tag is found 0 is returned.. which is the first tag...
Here fixed it up:
Code: Select all
Public Function IndexOf(ByVal TagClass As String, ByVal TagPath As String) As Integer
For i As Integer = 1 To ObjectCount Step 1
If H2Tag(i).TagClass = TagClass And H2Tag(i).TagPath = TagPath Then
Return i
End If
Next
Return -1
End Function
Halo 2 Prophet - Skin with ease with the simple 3D point and click interface.
Halo 3 Research Thread - Contribute to the research into Halo 3.
Halo 3 Research Thread - Contribute to the research into Halo 3.