[Gambas-user] TreeView item focus

Ron_1st ronstk at ...239...
Sun Aug 23 09:01:03 CEST 2009


On Saturday 22 August 2009, Jean-Yves F. Barbier wrote:
> Fabien Bodard a écrit :
> > you can do that by hand !
> > 
> > no ?
> > 
> > in TreeView_Expand()
> 
> May be, I'm gonna dig this possibility (I don't already know all about
> widgets, so I still miss some skills)
> 
> But @ first glance I don't know what could change as I'll trigger this
> event each time I expand a branch, good, 

no?
Lets assume the treeview show directories. On the side there is a listview.
If it is a file browser like konqueror/nautilus then you have a list of files.
When you click "on the directory" { treeview_click() } the listview get the file list for it.
When you click "on the plus/minus" { treeview_expand() } you want to expand the treeview.

Here the treeview_expand() event can read the directory and add found 
directories to the treeview. 
Else you must fill the treeview with ALL directories on your system and take 
the risk the directory does not exists at the moment you expand this directory. 
Also you miss the add directories after you did fill initial the treeview.

Now you want to move a file in the listview to other place. 
You scroll down in the treeview expand some directory and there expand onother. 
Now you can drag/drop from the listview a selected file to the last expanded in the treeview.
That is the good reason to not make the expanded directory the "selected" one.

> BUT if I'm still stuck with  treeview root as current leaf... how would I know where I am?
> 
> > Last.Item.Selected=true
> 
> This one is impossible, precisely because if I only expand branches
> without selecting any item, focus' stuck on the treeview root.

???
As far I know Last.Item is the one from the expand event and should work.
(treeview_Selected() event?)

>  
> > On some case we don't want to change the item selected.... so by
> > default it is better like that
> 
> Having the choice would be great... 
> (some cases or almost any cases? I'm pretty sure it is 'some'.)
> 
> JY

Therefore if those events as _expand and _click did not exist you had to fill the
treeview and listview with all directories and files on your system at opening
of the form. With more the 200 directories and over 10000 files it is done in less
then 1 nano second. Just for a filemanager example.

Best regards,

Ron_1st

-- 




More information about the User mailing list