no visual affect on Tree.selectedNode

specci48

Well-Known Member
Licensed User
This is a question to the .Net experts.

If I select a node by tabbing on the display (or clicking on a node on the desktop) the node ist selected AND the node gets colored to show the selection.
If I select a node by coding Tree.selectedNode = ... the node is selected but NOT colored to show the selection. Why?

I want the user to be able to move a selected node up or down in a treeview. First, the user selects a node by tabbing. The node gets colored and everything is ok.
Since there is no build in function to move up or down a node, I delete the node and insert it again one position up or down.
Then I automatically select the moved node in the program so the user could press the up or down button without tabbing on the node again. But my program driven selection is not visible to the user ... so he has to guess which node will move if he presses up or down.

Any solutions available? :sign0163:


specci48
 

dzt

Active Member
Licensed User
Hi there specci48,

I thing that to see the selection, TreeView should have the focus.
After Up or DOWN button click, move the focus again to TreeView.

I hope I helped.

Regards
 

dzt

Active Member
Licensed User
Hi,

I took it personally.:)

The focus method will be added to this control (and other control-libraries as well) as part of the ControlsEx library.
This should fix the problem you've encountered.
In then meantime, two workarounds.

1. If in the form dispose every other (except the TreeView) focus-able control after selecting a TreeView node, then the focus returns to TreeView. After this you can add the controls again at runtime (AddButton etc)

2. You can use for "UP NODE" and "DOWN NODE" instead of buttons something focus-unable, for example a label, and in that way TreeView won't loose the focus. Look my Clickable Label example here http://www.basic4ppc.com/forum/showthread.php?t=748 at dzEventsMagic thread (post #8).
 

specci48

Well-Known Member
Licensed User
Hi dzt,

I testet workaround 2. with the LinkLabel library and it worked. :)

The focus method will be added to this control (and other control-libraries as well) as part of the ControlsEx library.
This should fix the problem you've encountered.
Sounds nice. But what is the ControlsEx library? When will it be released? (OK, everytime the same questions...;))


specci48
 

dzt

Active Member
Licensed User
Sounds nice. But what is the ControlsEx library?
Have a look at this thread http://www.basic4ppc.com/forum/showthread.php?t=750

When will it be released? (OK, everytime the same questions...;))
Maybe it could be someone to stay all night just outside Erel's home and make terrible noise, so he couldn't sleep and stay focused to B4PPC development!

Maybe I'll try it myself as I am quite near to Israel.:)
 
Top