Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Basic4ppc (Windows Mobile) > Questions (Windows Mobile)
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Questions (Windows Mobile) Post any question regarding Basic4ppc.

Another problem with tree view

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-19-2008, 08:01 PM
RandomCoder's Avatar
Basic4ppc Expert
 
Join Date: May 2007
Location: Derbyshire, UK
Posts: 623
Awards Showcase
Beta Tester 
Total Awards: 1
Default Another problem with tree view

Once again I find myself in need of help using the tree view control, I feel that I am becoming some what of a nuisance

What I am attempting to do is use the SelectedNode to indentify the IndexOfNode, which works perfectly for the first level of the tree but returns -1 for the second level because node2's parent is node1.
I've attempted changing the parent of node 2 amongst other things but all without success.

Attached is a small sample program to try and show what I am trying to achieve.

Please help once again
Thanks,
RandomCoder
Attached Files
File Type: sbp Tree View.sbp (1.0 KB, 14 views)
__________________
"Defeat never comes to any man until he admits it."Josephus Daniels
Reply With Quote
  #2 (permalink)  
Old 02-19-2008, 09:01 PM
specci48's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: Germany
Posts: 1,057
Awards Showcase
Beta Tester Forum Contributer 
Total Awards: 2
Default

Hello RandomCoder,

does this code what you are trying to attempt???
Code:
Sub tree_afterselect
  
If tree.Action="bymouse" Then        
    node1.value = tree.SelectedNode
    
Do Until node1.IsRoot
      node1.value = node1.parent
    
Loop        
    Row = tree.IndexOfNode(node1.value)
    
Msgbox"Row "&table1.Cell("ID",Row)&" - "&table1.Cell("Message",Row))
  
End If
End Sub

specci48
Reply With Quote
  #3 (permalink)  
Old 02-19-2008, 09:16 PM
RandomCoder's Avatar
Basic4ppc Expert
 
Join Date: May 2007
Location: Derbyshire, UK
Posts: 623
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Quote:
Originally Posted by specci48 View Post
Hello RandomCoder,

does this code what you are trying to attempt???
Specci48, your my new hero

Thats exactly what I've been trying to do but without success.
Just couldn't get my head round where I was going wrong.

Thanks so much,
RandomCoder
__________________
"Defeat never comes to any man until he admits it."Josephus Daniels
Reply With Quote
  #4 (permalink)  
Old 02-27-2008, 02:59 PM
RandomCoder's Avatar
Basic4ppc Expert
 
Join Date: May 2007
Location: Derbyshire, UK
Posts: 623
Awards Showcase
Beta Tester 
Total Awards: 1
Default Today I new problem....

I've got a context menu working with my treeview which allows me to switch to different panels, i.e back to the main menu.
But I would also like to use the context menu to perform certain actions on the selected node, such as reply or delete etc.
Here is my problem.
The AfterSelect event is not triggered by the context menu and so when I select to reply it is acting on the wrong value (node).
Attached is a sample code to demonstrate the problem.....

Any help, would as ever be greatly appreciated.

Thanks,
RandomCoder
Attached Files
File Type: zip TreeTest.zip (14.4 KB, 15 views)
__________________
"Defeat never comes to any man until he admits it."Josephus Daniels
Reply With Quote
  #5 (permalink)  
Old 02-27-2008, 08:50 PM
specci48's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: Germany
Posts: 1,057
Awards Showcase
Beta Tester Forum Contributer 
Total Awards: 2
Default

Hi RandomCoder,

sorry but I don't have an answer for this avaliable

The Problem is not the AfterSelect event, because if you look carefully, using the context menu e.g. at the 5th entry, the 5th entry is highlited BUT the original node ist still seleced. The still selected node is marked with an outlined box. And after the MsgBox from the context menu is closed, the still selected "original" node is re-highlited again.

A reason for this behavior could be that the context menu is added to the whole treeview and not to every single node. So the context menu is treated always the same ignoring on which position you called it.

specci48
Reply With Quote
  #6 (permalink)  
Old 02-27-2008, 08:56 PM
RandomCoder's Avatar
Basic4ppc Expert
 
Join Date: May 2007
Location: Derbyshire, UK
Posts: 623
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Hi Specci48,

I too see the problem and tried to force the AfterSelect from within the Context Menu click event but still with no success.
After exhausting all my idea's I thought it time to put it to the forum.

Erel, do you have any idea's or is it possible to add this feature in a future release?

Regards,
RandomCoder
__________________
"Defeat never comes to any man until he admits it."Josephus Daniels
Reply With Quote
  #7 (permalink)  
Old 02-27-2008, 09:09 PM
specci48's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: Germany
Posts: 1,057
Awards Showcase
Beta Tester Forum Contributer 
Total Awards: 2
Default

One small addition...

Since some controls behave different on the desktop and on the device (and for the treeview there are A LOT of differences ) I testet your code on the device.

The result:
On the device the context menu is called with a "tap and hold" action. If I run your original code, calling the context menu DOES select the new node since the device does not know, how long your stylus will be held on the display. The AfterSelect is fired and even overlaps the ContextMenu_Click event so the Sub ContextMenu_Click is never executed.
A possible solution for a (device) working code could be: Put all your needed code into the ContextMenu_Click Sub and delete the AfterSelect event...


specci48
Reply With Quote
  #8 (permalink)  
Old 02-27-2008, 09:31 PM
RandomCoder's Avatar
Basic4ppc Expert
 
Join Date: May 2007
Location: Derbyshire, UK
Posts: 623
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Thanks, I'll persevere and report back.
One other solution I've just thought of is to trigger the context menu click event using the afterselect of the treeview so that each time a node is selected it displays the context menu allowing the user to choose from the options.
Its not ideal but it might work.

I've also noticed that if I scroll down the nodes or click on the treeview control (not a node), then a node is highlighted and the afterselect event is fired. Therefore I can record which node it is, BUT if I then tap on that same node there is no way of detecting it.
I think that a click event would also be useful for the treeview control.

Regards,
RandomCoder
__________________
"Defeat never comes to any man until he admits it."Josephus Daniels
Reply With Quote
  #9 (permalink)  
Old 02-28-2008, 11:36 AM
RandomCoder's Avatar
Basic4ppc Expert
 
Join Date: May 2007
Location: Derbyshire, UK
Posts: 623
Awards Showcase
Beta Tester 
Total Awards: 1
Default

Quote:
Originally Posted by specci48 View Post
One small addition...

Since some controls behave different on the desktop and on the device (and for the treeview there are A LOT of differences ) I testet your code on the device.

The result:
On the device the context menu is called with a "tap and hold" action. If I run your original code, calling the context menu DOES select the new node since the device does not know, how long your stylus will be held on the display. The AfterSelect is fired and even overlaps the ContextMenu_Click event so the Sub ContextMenu_Click is never executed.
A possible solution for a (device) working code could be: Put all your needed code into the ContextMenu_Click Sub and delete the AfterSelect event...


specci48
Thanks,
I can confirm that I have now got this working by removing the afterselect event and using the context menu.
This does mean that I must now tap and hold the node then select an action but at least it performs the action on the correct node.
I've requested a Click Event for the treeview control which will resolve this problem, see here http://www.basic4ppc.com/forum/showt...0130#post10130.

Regards,
RandomCoder
__________________
"Defeat never comes to any man until he admits it."Josephus Daniels
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 Off
Pingbacks are Off
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Tree View - Help Cableguy Questions (Windows Mobile) 18 07-19-2008 12:43 PM
Registry to Tree View willisgt Questions (Windows Mobile) 0 02-20-2008 04:17 PM
Context Menu and Tree View. RandomCoder Questions (Windows Mobile) 4 02-18-2008 04:35 PM
Canīt view whole Website with PPC Browser Smurfy2000 Forum Discussion 3 02-13-2008 08:08 AM
Tree View Images RandomCoder Questions (Windows Mobile) 8 02-08-2008 04:16 PM


All times are GMT. The time now is 07:01 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0