You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pivot.apache.org by we...@gmx.net on 2010/05/03 16:40:10 UTC
Problems with setSelectedPath and TreeView
Hi!
I've got a searchfunction for elements in my treeview.
The result of the search function is a path to the searched node.
The problem now is, that the treeView doesn't want's to expand the branch and set the selection.
Even resetting the actual selection doesn't work.
public void buttonPressed(Button button) {
String term = searchTerm.getText();
if(term.trim().length() == 0)
return;
//Path path = searchById(term);
//Path path = new Path(0,0,0,1);
Path path = treeView.getSelectedPath();
//Alert.alert("Hab da was: " + path.toString(), window.getDisplay());
if(path != null) {
treeView.collapseAll();
treeView.expandBranch(path);
treeView.setSelectedPath(path);
}
}
As result I see a completely collapsed tree.
What's wrong?
thx!
--
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
Re: Problems with setSelectedPath and TreeView
Posted by Greg Brown <gk...@mac.com>.
I'm not as familiar with the inner workings of TreeView as Todd is, but I suspect that you may have to expand all branches in the path. Let me know if that doesn't work.
G
On May 3, 2010, at 10:40 AM, weisswurst@gmx.net wrote:
> Hi!
>
> I've got a searchfunction for elements in my treeview.
> The result of the search function is a path to the searched node.
>
> The problem now is, that the treeView doesn't want's to expand the branch and set the selection.
>
> Even resetting the actual selection doesn't work.
>
> public void buttonPressed(Button button) {
> String term = searchTerm.getText();
> if(term.trim().length() == 0)
> return;
> //Path path = searchById(term);
> //Path path = new Path(0,0,0,1);
> Path path = treeView.getSelectedPath();
> //Alert.alert("Hab da was: " + path.toString(), window.getDisplay());
> if(path != null) {
> treeView.collapseAll();
> treeView.expandBranch(path);
> treeView.setSelectedPath(path);
> }
> }
>
> As result I see a completely collapsed tree.
>
> What's wrong?
>
> thx!
> --
> GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
> Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01