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

Go Back   Android Development Forum - Basic4android > Basic4ppc (Windows Mobile) > Code Samples & Tips > Additional Libraries
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Additional Libraries Users contributed libraries.
This sub-forum is only available to licensed users.

Queries for Derez and Filippo

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-03-2010, 10:52 PM
RacingDog's Avatar
Senior Member
 
Join Date: Apr 2009
Location: Fleet, Hants, UK
Posts: 183
Send a message via Yahoo to RacingDog
Default Queries for Derez and Filippo

If you guys are around.........

Derez, in your TreeViewPlus library, I was messing around to find out how the CheckBoxes and AfterCheck event worked. I came to the conclusion that the only way of testing in the event to see if the just checked box was the Root node was to look for the node IsRoot being set and the control IndexOfNode is -1. Is that correct? Is there a better way?

Filippo, in your ListView library, is there any chance of adding an AfterCheck event similar to that found in TreeView and TreeViewPlus? Without it, it is difficult to respond immediately and also to know what has just changed and in which direction (checked or un-checked).

It is strange, but the two libraries also have this difference, in TreeViewPlus, checking a box seems to cause both AfterCheck and AfterSelect events (that may be just an effect of referencing the control in the AfterCheck handler (maybe?)), whereas ListView does not cause a SelectionChanged event on checking a box. I have no idea which is correct, or whether there is such a thing as correct and it is just a matter of taste!

As usual, I may be missing something obvious!

Still, they are both nice libraries to have.

Thanks in advance.
Reply With Quote
  #2 (permalink)  
Old 07-04-2010, 06:24 AM
derez's Avatar
Basic4ppc Expert
 
Join Date: May 2007
Posts: 978
Awards Showcase
Beta Tester Competition Winner 
Total Awards: 2
Default

RacingDog

I am very glad to see that someone is looking at this library...

Quote:
I came to the conclusion that the only way of testing in the event to see if the just checked box was the Root node was to look for the node IsRoot being set and the control IndexOfNode is -1. Is that correct? Is there a better way?
The library is based on ControlsEx (by Erel or Agraham - I don't know) and the questions you ask should be asked with reference to the original, since I haven't changed anything on these events. The "plus" in the name is intended to say that there are more properties, like the Tag, font style and more.

edit: I checked the help and see this -
Quote:
The AfterCheck event occurs after the user checks / unchecks a node.
You should use the CheckedNode property to find which node was checked.
Example:
...
'This sub will fire when the user checks or unchecks one of the nodes.
Sub tv_AfterCheck
If tv.Action = "unknown" Then Return
node.Value = tv.CheckedNode
Msgbox(node.Text,node.Checked)
End Sub
so you have the node's value after check. With TreeviewPlus you have also the node.Tag, so if you identify your nodes when creatibg them using Tags, then you have the node's identification immediately.
__________________
David Erez
Ramat Hasharon, Israel

Last edited by derez : 07-04-2010 at 11:23 AM.
Reply With Quote
  #3 (permalink)  
Old 07-04-2010, 11:25 AM
RacingDog's Avatar
Senior Member
 
Join Date: Apr 2009
Location: Fleet, Hants, UK
Posts: 183
Send a message via Yahoo to RacingDog
Default

Thanks Derez. AGraham, Erel, over to you wrt to my TreeView query above? Ta.
Reply With Quote
  #4 (permalink)  
Old 07-04-2010, 11:32 AM
derez's Avatar
Basic4ppc Expert
 
Join Date: May 2007
Posts: 978
Awards Showcase
Beta Tester Competition Winner 
Total Awards: 2
Default

But the simplest way is to check:

Code:
node.Value = tv.CheckedNode
         
if node.isroot then ....
__________________
David Erez
Ramat Hasharon, Israel
Reply With Quote
  #5 (permalink)  
Old 07-04-2010, 12:20 PM
RacingDog's Avatar
Senior Member
 
Join Date: Apr 2009
Location: Fleet, Hants, UK
Posts: 183
Send a message via Yahoo to RacingDog
Default

99.9% of the time that is correct. It would seem I was being mislead by a previously undetected bug which explains why I was seeing selection events. Basically, if the first click on the contol is 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.

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

I'll put it into the bug list so everyone is more likely see it. You like this, not a lot alot, but you will like it, Well Erel or Graham will
Reply With Quote
  #6 (permalink)  
Old 07-05-2010, 02:42 PM
RacingDog's Avatar
Senior Member
 
Join Date: Apr 2009
Location: Fleet, Hants, UK
Posts: 183
Send a message via Yahoo to RacingDog
Default

Derez, in my current proggy it was avoidable (so far), but in general it may not be, but there seems to be a problem with the FindByText1 method. It seems to be expected that the item will be found, if it is not then a run time error is reported saying that length must be > 0. I have nothing called length, so it's down in the depths somewhere.

I was thinking of adding a "don't add a duplicate" check to my proggy which would need that method, but that would also have to work first time around when the key is not present.

The other finds and selects may behave the same, I haven't checked, didn't need to.

Ummm, it's not in the help, but it's listed in the pop up when editing, so what does ToString do and what is the syntax? Or was that just a debug tool that never quite got removed?
Reply With Quote
  #7 (permalink)  
Old 07-05-2010, 03:25 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

Quote:
Originally Posted by RacingDog View Post
so it's down in the depths somewhere.
Not very far down, it's in FindByText1 itself. He needs to add a check for an empty string before attempting a SubString on it.

Quote:
so what does ToString do and what is the syntax?
Every .NET object has a ToString() method inherited all the way back from the Object class itself at the top of the object inheritance hierarchy. The default is to return the Class name but on the desktop Framework many of the classes override it to give useful information. For example a Color object returns a string detailing its RGB components. The Compact Framework on the device doesn't do this much, presumably to save space, so it is less useful there.

The syntax is just Someobject.ToString. It is not very useful in Basic4ppc as you can only invoke it on library objects except when playing with the Door library where it is a useful way of seeing that the object you've picked up is the right one.

Msgbox(Obj1.RunMethod("ToString"))
__________________
Sorry, but I don't answer questions by PM or email.
Please post your queries in the forum.

Last edited by agraham : 07-05-2010 at 03:28 PM.
Reply With Quote
  #8 (permalink)  
Old 07-05-2010, 07:32 PM
derez's Avatar
Basic4ppc Expert
 
Join Date: May 2007
Posts: 978
Awards Showcase
Beta Tester Competition Winner 
Total Awards: 2
Default

Thanks for the comment, i'll correct it soon.
What would you prefer as the return of the method in the case that the string to be found is empty ?
__________________
David Erez
Ramat Hasharon, Israel

Last edited by derez : 07-05-2010 at 07:43 PM.
Reply With Quote
  #9 (permalink)  
Old 07-05-2010, 08:18 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

I'm not sure that the question is aimed at me but I think an empty string is the obvious one.
__________________
Sorry, but I don't answer questions by PM or email.
Please post your queries in the forum.
Reply With Quote
  #10 (permalink)  
Old 07-05-2010, 08:32 PM
RacingDog's Avatar
Senior Member
 
Join Date: Apr 2009
Location: Fleet, Hants, UK
Posts: 183
Send a message via Yahoo to RacingDog
Default

Yes, an empty string, no point in making things complicated. But just to be safe, remember to run an eye over the other Find methods and selectbytag (he said being old and suspicious).

Thanks guys.
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
Frage an Filippo newbie German Forum 16 09-28-2009 08:32 PM
@Derez and Klaus wm.chatman Questions (Windows Mobile) 4 05-18-2009 04:02 PM
Filippo listview sqlite with where clause RB Smissaert Questions (Windows Mobile) 0 12-31-2008 01:41 PM


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


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