You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pivot.apache.org by Tim Collins <ti...@simplenetsoftware.com> on 2011/09/10 18:40:48 UTC

How do I mouseOver one component and cause one or more other components to also highlight?

Hi all,

I have a Panel with a Button and a TreeView.  In my mouseOver() listener for the 
Button I want to highlight the TreeView and vice versa.  The effect I want is 
that there is a single widget with two areas that could be clicked on.

I am trying to emulate the Windows 7 Control Panel, which has an elegant way to 
let the 

user navigate an arbitrarily complex tree of possible child control panels, much 

like "breadcrumbs", but better.  To see what I mean, if you go from Start to 
"Control Panel" and then click on "Programs" then "Default Programs" you see a 
list of four buttons that would be breadcrumbs if this were a web page:   ">"  
"Control Panel >"  "Programs >"    "Default Programs".  Unlike your typical 
breadcrumb list, with this approach you can jump to any parent in the path and
also to any of the immediate children of any parent in the path.   This is 
actually
a pretty elegant improvement on the old "breadcrumb" link list.

Tim Collins

Re: How do I mouseOver one component and cause one or more other components to also highlight?

Posted by Chris Bartlett <cb...@gmail.com>.
Tim,

Could you attach a screenshot for those of us not using Windows 7?

It sounds like you might be able to do something similar to Pivot's
ButtonGroup class.
http://svn.apache.org/repos/asf/pivot/trunk/wtk/src/org/apache/pivot/wtk/ButtonGroup.java
(and also http://svn.apache.org/repos/asf/pivot/trunk/wtk/src/org/apache/pivot/wtk/RadioButtonGroup.java)

Create some kind of (most likely) non-visible container that you then
add references to 'linked' Components.  When those Components are
added to the container, add a common mouse listener to pick up the
mouseover events (and remove it when they are removed).  That listener
might apply/remove a Decorator to all Components in the container.
http://pivot.apache.org/2.0/docs/api/org/apache/pivot/wtk/effects/Decorator.html
http://pivot.apache.org/tutorials/effects.html

Just to be clear - the 'container' need not be an actual
org.apache.pivot.wtk.Container
If it is a simple 'set' of some kind (like ButtonGroup) then you will
be able to 'link' Components regardless of where they exist within the
UI.

Chris

On 10 September 2011 23:40, Tim Collins <ti...@simplenetsoftware.com> wrote:
> Hi all,
>
> I have a Panel with a Button and a TreeView.  In my mouseOver() listener for
> the Button I want to highlight the TreeView and vice versa.  The effect I
> want is that there is a single widget with two areas that could be clicked
> on.
>
> I am trying to emulate the Windows 7 Control Panel, which has an elegant way
> to let the
> user navigate an arbitrarily complex tree of possible child control panels,
> much
> like "breadcrumbs", but better.  To see what I mean, if you go from Start to
> "Control Panel" and then click on "Programs" then "Default Programs" you see
> a
> list of four buttons that would be breadcrumbs if this were a web page:
> ">"
> "Control Panel >"  "Programs >"    "Default Programs".  Unlike your typical
> breadcrumb list, with this approach you can jump to any parent in the path
> and
> also to any of the immediate children of any parent in the path.   This is
> actually
> a pretty elegant improvement on the old "breadcrumb" link list.
>
> Tim Collins