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

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

Bug Reports Post about errors or bugs encountered.

Initial TreeView checkbox click problem

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-04-2010, 12:36 PM
RacingDog's Avatar
Senior Member
 
Join Date: Apr 2009
Location: Fleet, Hants, UK
Posts: 183
Send a message via Yahoo to RacingDog
Default Initial TreeView checkbox click problem

This comment relates to the recent thread in the Addition Libraries section, where Derez assures me his TreeViewPlus didn't mess with the event handling of the TreeView. So I'm repeating the info here....

We are talking of a TreeView with checkboxes.

Basically, if the first click on the contol is a check box, it doesn't matter which one, but as well as the check box being ticked, the Root node gets selected and a AfterSelect event occurs during the AfterEvent event, regardless of which node's check box you actually clicked on. This doesn't happen on a plain node selection being your first click. It doesn't happen on any subsequent click.

Another minor query, if I refer to the Root node by node2.Value = tv.GetNode(0), why is node2.IndexOfNode -1? It should surely be the same as the parameter to GetNode, afterall, it is the same node we are talking about.

I was playing with Derez's sample proggy to see how things hung together, so I'll attach the very slightly modified version I was using that found this problem.

Put a break on line 37. Run the prog. Click on any child text box (and nothing else. single step through the evemts to see what I mean. Then continue to Run to see the Root node selection on the control and the text in my little message box.

Continue without the breakpoint and try both the Root check box and the child check box you previously used and note the message box text understand the second comment.

Ta chaps.
Attached Files
File Type: sbp tree.sbp (3.6 KB, 11 views)

Last edited by RacingDog : 07-04-2010 at 12:39 PM.
Reply With Quote
  #2 (permalink)  
Old 07-04-2010, 02:19 PM
RacingDog's Avatar
Senior Member
 
Join Date: Apr 2009
Location: Fleet, Hants, UK
Posts: 183
Send a message via Yahoo to RacingDog
Default

Just to add to the confusion, if you run it without the breakpoint then the content of message box is different for a first click on a child checkbox, but the Root node still shows as selected. Baffled.
Reply With Quote
  #3 (permalink)  
Old 07-04-2010, 02:24 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 6,072
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default

ControlsEx is an official Basic4ppc library, my extensions are ControlsExDevice and ControlsExDesktop.

The standard Treeview in ControlsEx behaves the same as a TreeviewPlus. The selection of the root when a checkbox is first selected seems to be a "feature" of the underlying .NET control. What I suspect is happening is that the first time the Treeview gets the focus it has to select something if nothing was selected before so it selects the parent node and you get an AfterSelect event because the selection has effectively changed. It seems to not reference the checkboxes in deciding what node to select because the checkboxes are an displayable option and it appears that they are not included in the selection process. You can see this by selecting any node then clicking any other checkbox, the selected node does not change. A bit of an untidy implementation really!

The answer to the second point lies in this line from the help "If the node does not belong to the current node, it will return -1." When you select the root node both node1 and node2 in the example are the root node so node1 does not have a child relationship to node2 so the return value is -1.
__________________
Sorry, but I don't answer questions by PM or email.
Please post your queries in the forum.
Reply With Quote
  #4 (permalink)  
Old 07-04-2010, 02:36 PM
RacingDog's Avatar
Senior Member
 
Join Date: Apr 2009
Location: Fleet, Hants, UK
Posts: 183
Send a message via Yahoo to RacingDog
Default

Ah, Gotcha! Yes somewhat untidy.

My second post means I should be able to do what I was hoping to do as it is only the breakpoint which made an unwanted Root IndexOf value appear in place of the child node's value.

Thanks for the info.
Reply With Quote
  #5 (permalink)  
Old 07-05-2010, 10:38 AM
RacingDog's Avatar
Senior Member
 
Join Date: Apr 2009
Location: Fleet, Hants, UK
Posts: 183
Send a message via Yahoo to RacingDog
Default

Just to clarify a point....

Further research shows the autoselected node on first click is not the Root, but the tail end of the nodes list in the control (ie all created via the control's AddNewNode method). I was being misled before because the sample I was playing with only had one node in there, the rest being created via node AddNewNode.

It's still a nuisance though.
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
AddEvent for checkbox TWELVE Questions (Windows Mobile) 4 07-07-2010 07:14 AM
Checkbox Status ceaser Questions (Windows Mobile) 3 12-11-2009 03:02 PM
TreeView Click Event RandomCoder Basic4ppc Wishlist 5 02-28-2008 03:23 PM
ListView and checkbox magi6162 Questions (Windows Mobile) 2 09-19-2007 07:30 AM
Problem mit SQLite und CheckBox Fontanus German Forum 6 05-06-2007 03:03 PM


All times are GMT. The time now is 04:05 PM.


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