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.


Another problem with tree view


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-19-2008, 09:01 PM
RandomCoder's Avatar
Basic4ppc Veteran
 
Join Date: May 2007
Location: UK
Posts: 486
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, 9 views)
__________________
Desktop: Pentium D 920 (2.8GHz, 4MB L2 Cache, 800MHz FSB), 1024MB, 256MB Radeon X600, 250GB HD.
Device : Axim X51v XScale 624MHz, 3.7" VGA, 64MB SDRAM, 256MB Flash ROM + 1Gb SD.

"Defeat never comes to any man until he admits it."Josephus Daniels
Reply With Quote
  #2 (permalink)  
Old 02-19-2008, 10:01 PM
specci48's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: Germany
Posts: 650
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, 10:16 PM
RandomCoder's Avatar
Basic4ppc Veteran
 
Join Date: May 2007
Location: UK
Posts: 486
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
__________________
Desktop: Pentium D 920 (2.8GHz, 4MB L2 Cache, 800MHz FSB), 1024MB, 256MB Radeon X600, 250GB HD.
Device : Axim X51v XScale 624MHz, 3.7" VGA, 64MB SDRAM, 256MB Flash ROM + 1Gb SD.

"Defeat never comes to any man until he admits it."Josephus Daniels
Reply With Quote
  #4 (permalink)  
Old 02-27-2008, 03:59 PM
RandomCoder's Avatar
Basic4ppc Veteran
 
Join Date: May 2007
Location: UK
Posts: 486
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, 9 views)
__________________
Desktop: Pentium D 920 (2.8GHz, 4MB L2 Cache, 800MHz FSB), 1024MB, 256MB Radeon X600, 250GB HD.
Device : Axim X51v XScale 624MHz, 3.7" VGA, 64MB SDRAM, 256MB Flash ROM + 1Gb SD.

"Defeat never comes to any man until he admits it."Josephus Daniels
Reply With Quote
  #5 (permalink)  
Old 02-27-2008, 09:50 PM
specci48's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: Germany
Posts: 650
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, 09:56 PM
RandomCoder's Avatar
Basic4ppc Veteran
 
Join Date: May 2007
Location: UK
Posts: 486
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
__________________
Desktop: Pentium D 920 (2.8GHz, 4MB L2 Cache, 800MHz FSB), 1024MB, 256MB Radeon X600, 250GB HD.
Device : Axim X51v XScale 624MHz, 3.7" VGA, 64MB SDRAM, 256MB Flash ROM + 1Gb SD.

"Defeat never comes to any man until he admits it."Josephus Daniels
Reply With Quote
  #7 (permalink)  
Old 02-27-2008, 10:09 PM
specci48's Avatar
Basic4ppc Expert
 
Join Date: Apr 2007
Location: Germany
Posts: 650
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, 10:31 PM
RandomCoder's Avatar
Basic4ppc Veteran
 
Join Date: May 2007
Location: UK
Posts: 486
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
__________________
Desktop: Pentium D 920 (2.8GHz, 4MB L2 Cache, 800MHz FSB), 1024MB, 256MB Radeon X600, 250GB HD.
Device : Axim X51v XScale 624MHz, 3.7" VGA, 64MB SDRAM, 256MB Flash ROM + 1Gb SD.

"Defeat never comes to any man until he admits it."Josephus Daniels
Reply With Quote
  #9 (permalink)  
Old 02-28-2008, 12:36 PM
RandomCoder's Avatar
Basic4ppc Veteran
 
Join Date: May 2007
Location: UK
Posts: 486
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
__________________
Desktop: Pentium D 920 (2.8GHz, 4MB L2 Cache, 800MHz FSB), 1024MB, 256MB Radeon X600, 250GB HD.
Device : Axim X51v XScale 624MHz, 3.7" VGA, 64MB SDRAM, 256MB Flash ROM + 1Gb SD.

"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 On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Tree View - Help Cableguy Questions & Help Needed 18 07-19-2008 01:43 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 04:00 AM.


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