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!
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
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
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?
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.
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).