[Gambas-user] webtree select from code

Marco Ancillotti gambas at servinfo.it
Sat Nov 12 10:43:22 CET 2022

Il 11/11/22 21:05, BB ha scritto:
> I presume that you are trying to select a node as if the user clicked 
> on it.
> The trick is to read _every word_ of the help page. WebTree.MoveFirst 
> moves the index of the *internal cursor*. It does nothing about the 
> "selection" on the screen. What you want is to find a particular node, 
> which is a *_WebTreeItem*, and set its *Selected* property. I note 
> that the help page for the _WebTreeItem hasn't been written yet but we 
> can assume that it is the same as the TreeView._TreeItem property. So 
> research that page 
> <https://gambaswiki.org/wiki/comp/gb.qt4/_treeview_item>.
I've read the help page , I try using same way as TreeView but don't work.

This TreeView code work without problem:

/Treeview1.Add("0", "CIAO", Picture.Load("icon:/32/add"))//
// Treeview1.Add("1", "PIPPO", Picture.Load("icon:/32/agenda"))//
// Treeview1.Add("2", "PLUTO", Picture.Load("icon:/32/alarm"))//
// Treeview1.Add("3", "MINNI", Picture.Load("icon:/32/blue"))//
// Treeview1.Add("4", "TOPO", Picture.Load("icon:/32/color"))//
// Treeview1["0"].Selected = True/

But when I do the same with WebTree on the line where I set selected = 
true I get:

/Type mismatch: wanted String, got _WebTreeItem instead/

The line is the same:

WebTree1["0"].Selected = True

What is wrong ? I'm using dev ppa on ubuntu ( 3.17.90 ).


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20221112/cfe4449d/attachment.htm>

More information about the User mailing list