Re: EuGTK:Replacing TreeView Data
- Posted by irv Aug 24, 2019
- 1221 views
Irv, when I'm using
set(myTV,"data",newTVData)
it's appending newTVData to what already exists in the TreeView.
How do I replace the TreeView data?
set(myTV,"data","clear") -- out with the old, set(myTV,"data",newTVData) -- in with the new.
However there may be more required - depending upon how you've set up to select an item.
Options are:
[1] connect(tv,"row-activated","ShowSelection") -- open on mouse click; [2] connect(selection,"changed","ShowSelection") -- open on mouseover;
Using option [1], the list will expand as the mouse hovers over an item, i.e. if you hover over Linux, then Linus Torvalds will be displayed below it. But it won't be selected (won't trigger the ShowSelection function). Clicking on an item will call the function. This is the "correct" action.
Using option [2], will cause each item to be selected in turn when the list is changed. So not appropriate for this application. Maybe useful in other situations, however.
BTW: Just as it stands, the tree view will have a search function built in ready to use. Just expand the list, hit ctl-f, and type something into the little box that shows up. For example, typing bo will immediately select Bowser. Typing bi will select Bill Gates. Hitting the down arrow will select the next match, Billy...
Note that it will only find those matches if they are open. Example: if your list had Hand Tools->Drills and Power Tools->Drills, typing in dri would only highlight both Drills if both Hand Tools and Power Tools categories were "expanded". Experiment.
Very handy, and completely free!
https://openeuphoria.org/pastey/315.wc