Basic4ppc - Windows Mobile Development  

Go Back   Basic4ppc - Windows Mobile Development > Main Category > Questions & Help Needed
Home Register FAQ Members List Search Today's Posts Mark Forums Read

Questions & Help Needed Post any question regarding Basic4ppc.


Tree View - Help


Reply
 
LinkBack Thread Tools Display Modes
  #11 (permalink)  
Old 06-07-2008, 05:44 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 3,186
Default

To limit it to two levels you can use something like:
Code:
Sub btnAdd_Click
    If IsNull(tree.SelectedNode) Then
        Msgbox("Please select a node.")
        Return
    End If
    node.Value = tree.SelectedNode
    If Not(node.IsRoot) Then
        Msgbox("too deep!")
    Else
        node.AddNewNode(txtName.Text)
    End If
    tree.ExpandAll
End Sub
Reply With Quote
  #12 (permalink)  
Old 06-07-2008, 10:27 AM
Cableguy's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: N 41º11'30.30" W 8º39'46.60"
Posts: 1,343
Awards Showcase
Forum Contributer 
Total Awards: 1
Default

Thanks Erel...
Your help has been precious ...
One future problem in this project...
How are the node indexed?
Imagins this tr
Defaut.INI
|
+-[Categoty01]
|XXX|
|XXX+-Key02
|XXX+'Coment04
|
+-[Category02]
XXXX|
XXXX+Key01

Key01 was of course created before key02, but key02 is "read" before key01...
is the index automatically corrected, an the index of key02 is lower than index of key01, or will I need to make sure to read in the correct order?
__________________
Paulo Gomes
Porto, Portugal

PC: Dual-Core 1,8Ghz, 2GB RAM, 80GB HD
PPC: Qtek9000, 1GB SD

DLL Version Listing
Reply With Quote
  #13 (permalink)  
Old 06-07-2008, 10:46 AM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 3,186
Default

Node.IndexOfNode returns the index of the node related to his parent.
Reply With Quote
  #14 (permalink)  
Old 06-07-2008, 10:57 AM
Cableguy's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: N 41º11'30.30" W 8º39'46.60"
Posts: 1,343
Awards Showcase
Forum Contributer 
Total Awards: 1
Default

Thanks, I rhink I understand....
I nedd to first catch the cat index related to the root and then catch the other nodes related to the categories....
cool....some cicles comming up....
__________________
Paulo Gomes
Porto, Portugal

PC: Dual-Core 1,8Ghz, 2GB RAM, 80GB HD
PPC: Qtek9000, 1GB SD

DLL Version Listing
Reply With Quote
  #15 (permalink)  
Old 06-10-2008, 10:07 PM
Cableguy's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: N 41º11'30.30" W 8º39'46.60"
Posts: 1,343
Awards Showcase
Forum Contributer 
Total Awards: 1
Default

Once more I need guidance working with the treeview...

I nedd to read a file(.INI) and, acording with some StrAt values, create the appropiate levels and sub-levels of the treeview nodes...
I have been to the point of being able to read and create all the read nodes, but all at the same level...

When i read an INI file, if it is a complex one, I have to be able to create the sub-levels, but how...I keep getting an error of "invalid reference " or whatever..

Example Treeview result :
+Default.INI
|--Key01
|--Comment01
+-Category01
XX|-Key02
XX|-Comment02
+-Category02
XX|-Key03
XX|-Comment03


INI File:
Key01
'Comment01

[Category01]
Key02
'Comment02

[Category02]
Key03
'Comment03
Attached Files
File Type: sbp teste.sbp (5.0 KB, 4 views)
__________________
Paulo Gomes
Porto, Portugal

PC: Dual-Core 1,8Ghz, 2GB RAM, 80GB HD
PPC: Qtek9000, 1GB SD

DLL Version Listing
Reply With Quote
  #16 (permalink)  
Old 07-18-2008, 07:44 PM
Cableguy's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: N 41º11'30.30" W 8º39'46.60"
Posts: 1,343
Awards Showcase
Forum Contributer 
Total Awards: 1
Default

TreeView should be a more straight-foward, easy to understand control...

My current app, is based on this control, and i should have finish it a few weeks ago, but the vacations got in the way, along with some yet to resolve issues...
Now back to work, I need to clear some doubts...

Imagine this tree:
+Default.INI
|--Key01
|--Key02
|--Key03
|--Key04
|--Comment01
+-Category01
XX|-Key05
XX|-Comment02
+-Category02
XX|-Key06
XX|-Comment03

Now let's say I want to move The node "Comment01" up by 2 positions, to setle in beetwen of "Key02" and "Key03"..

I tryed to get the index of the selected node, as one must first select the node to be moved, but i keep getting a value of -1...

This is teh code and its variants I've used just to get the index of the selected node...
Code:
Index = Node.IndexOfNode(Tree.SelectedNode)
Index = Tree.IndexOfNode(Node.value)
I want to be ale to move the nodes up and down, always related to its Parent.
My tree wil be no deeper that 2 levels...

Please HELP
__________________
Paulo Gomes
Porto, Portugal

PC: Dual-Core 1,8Ghz, 2GB RAM, 80GB HD
PPC: Qtek9000, 1GB SD

DLL Version Listing
Reply With Quote
  #17 (permalink)  
Old 07-19-2008, 10:52 AM
specci48's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: Germany
Posts: 649
Default

Hello Cableguy,

I followed this thread for a while so after I finished my actual project now I uploaded my ToDoTree application here:
ToDoTree Application

I think this could be a good demo for you showing how I solved the (little) problems I got dealing with the treeview...
Some comments in the program are still in german but it shouldn't be difficult "read" my application.
And of course feel free to ask futher questions if you need more explanation to the code...


specci48
Reply With Quote
  #18 (permalink)  
Old 07-19-2008, 12:08 PM
Cableguy's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: N 41º11'30.30" W 8º39'46.60"
Posts: 1,343
Awards Showcase
Forum Contributer 
Total Awards: 1
Default

Going Back to Erel's example, I was able to deternime the Level of the selected node....
And I am able to determine the index of level 1 nodes....But not level 2...What am I missing????

Code:
If Node.IsRoot Then
Parent.Value = Node.Value
Else
Parent.Value = Node.Parent
End If
Level = 1
Do While Not(Parent.IsRoot)
level = level + 1
Parent.Value = Parent.Parent
Loop
MsgBox(level) 'Tels me the level of the selected Node, wich can be 1 or 2...
If Level = 1 Then
Index = Parent.IndexOfNode(TreeView.SelectedNode)'This works and I do get the index of the selected node on level 1
Else If Level = 2
Index = Node.IndexOfNode(TreeView.SelectedNode)'Can't Figure out how to get the index for level 2 nodes
End If
Msgbox(Index)'Level 2 nodes alway return -1 values
Thanks for all the help...
__________________
Paulo Gomes
Porto, Portugal

PC: Dual-Core 1,8Ghz, 2GB RAM, 80GB HD
PPC: Qtek9000, 1GB SD

DLL Version Listing

Last edited by Cableguy : 07-19-2008 at 12:11 PM.
Reply With Quote
  #19 (permalink)  
Old 07-19-2008, 01:43 PM
Cableguy's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: N 41º11'30.30" W 8º39'46.60"
Posts: 1,343
Awards Showcase
Forum Contributer 
Total Awards: 1
Default

Well, as most of the time happens, I end up answering my own question, simple because i keep trying to squeeze the answers from my code...

SO, I got it working with lesser code than i could Imagine...

Code:
If Node.IsRoot Then Return
Parent.Value = Node.Parent
Index = Parent.IndexOfNode(TreeView.SelectedNode)
If Index <= 0 Then Return
Parent.RemoveNodeAt(Index)
Parent.InsertNode(Index - 1,Node.Value)
Thanks for your help so far guys, surelly more questions will arise, as treeview is NOT a simple control to workwith.
__________________
Paulo Gomes
Porto, Portugal

PC: Dual-Core 1,8Ghz, 2GB RAM, 80GB HD
PPC: Qtek9000, 1GB SD

DLL Version Listing
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Another problem with tree view RandomCoder Questions & Help Needed 8 02-28-2008 12:36 PM
Registry to Tree View willisgt Questions & Help Needed 0 02-20-2008 05:17 PM
Context Menu and Tree View. RandomCoder Questions & Help Needed 4 02-18-2008 05:35 PM
Can´t view whole Website with PPC Browser Smurfy2000 Forum Discussion 3 02-13-2008 09:08 AM
Tree View Images RandomCoder Questions & Help Needed 8 02-08-2008 05:16 PM


All times are GMT. The time now is 02:33 PM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0