[Project_owners] nsISelectionController

Eric Jung grimholtz at yahoo.com
Mon Jul 18 05:48:20 EDT 2005


Thanks, HJ!


--- HJ <bugs4hj at netscape.net> wrote:

> Eric Jung wrote:
> > That's an interesting approach. I've been hiding the tree
> altogether
> > with a <deck/>... didn't know about nsISelectionController.
> 
> There are many different solutions for this 'problem' but I don't
> think 
> that you need a deck for it. For example: you can set attribute 
> 'disabled' to 'true' and use something like this:
> 
> #treeID[disabled] > treechildren {
>    background-color: -moz-Dialog;
> }
> 
> but that would still fire the onselect event so you also need this:
> 
> tree.view.selection.selectEventsSuppressed = true;
> 
> but you can also use something like:
> 
> function onClick(aEvent)
> {
>    var onclickRow = tree.treeBoxObject.getRowAt(aEvent.pageX,
> aEvent.pageY);
>    tree.view.selection.clearRange(onclickRow, onclickRow);
>    tree.currentIndex = -1;
> }
> 
> in combination with: <tree...onclick="onClick();"...
> 
> or you can use something like this:
> 
> function onClick(aEvent)
> {
>    var onclickRow = tree.treeBoxObject.getRowAt(aEvent.pageX,
> aEvent.pageY);
> 
>    if (aEvent.ctrlKey) {
>      var parentIndex =
> tree.treeBoxObject.view.getParentIndex(onclickRow);
> 
>      if (parentIndex >= 0 &&
> tree.view.selection.isSelected(parentIndex)) {
>        tree.view.selection.clearRange(onclickRow, onclickRow);
>        tree.currentIndex = parentIndex;
>      }
>    }
>    else
>      tree.currentIndex = onclickRow;
> }
> 
> to block users from selecting container children when the container
> is 
> selected. However, this will still 'flash' the selection on/off,
> and 
> that's what I'm trying to solve ;)
> 
> I hope this help you, or anyone else...
> 
> Happy coding,
> /HJ
> _______________________________________________
> Project_owners mailing list
> Project_owners at mozdev.org
> http://mozdev.org/mailman/listinfo/project_owners
> 



		
____________________________________________________
Start your day with Yahoo! - make it your home page 
http://www.yahoo.com/r/hs 
 


More information about the Project_owners mailing list