Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Hover and MouseListener on Composite with children
Hover and MouseListener on Composite with children [message #1709986] Fri, 02 October 2015 13:39 Go to next message
Antoni Mylka is currently offline Antoni MylkaFriend
Messages: 14
Registered: January 2015
Junior Member
I have a composite that changes color on hover:

Composite.someclass { background-color: #FFFFFF; }
Composite.someclass:hover { background-color: #f4f4f4; }


I have an instance of that composite that has a mouse listener and two children:

Composite c = new Composite(parent, SWT.NONE);
c.setData(RWT.CUSTOM_VARIANT,"someclass");
c.addMouseListener(someMouseListener);
c.setLayout(GridLayoutFactory.swtDefaults().numColumns(1).create());

Label l1 = new Label(c, SWT.INHERIT_DEFAULT);
l1.setText("Some text");

Label l2 = new Label(c, SWT.INHERIT_DEFAULT);
l2.setText("Other text");


Now the problem is that when I hover over the composite - the color changes and the mouse listener gets a click - as expected. When I move to a label - the color switches back to the original one and the mouse listener doesn't get the click even though the label is inside the composite.

How can I make children of a composite "transparent" wrt. to hover and the mouse listener on the parent. What if I have a deeper component hierarchy in there? Do I need to implement some overlay?
Re: Hover and MouseListener on Composite with children [message #1710632 is a reply to message #1709986] Thu, 08 October 2015 04:53 Go to previous message
Stefan Weiser is currently offline Stefan WeiserFriend
Messages: 55
Registered: February 2012
Member
I've got the same Problem.

I solved the click-event by adding the same Listener also to the Labels inside. I don't like that solution but it works.

For the hover problem I don't have a solution till now. I think that we have to add some Javascript, which manages the coloring. I hope that someone else has a better idea.
Previous Topic:File upload is broken in 3.0.1
Next Topic:Servlet Session in RAP
Goto Forum:
  


Current Time: Tue Mar 19 04:20:39 GMT 2024

Powered by FUDForum. Page generated in 0.02338 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top