Grid, Template and selected row image [message #1785204] |
Tue, 10 April 2018 15:53  |
Eclipse User |
|
|
|
In our application we are using a Grid with a Template that consists out of several TextCells and one ImageCell.
Everything works pretty well so far, but we couldn't find a way to exchange the image in selected state.
Reason why we like to change the image is that it is very dark, which works good on brighter backgrounds, but is barely visible, when a row was selected.
We already have the images in a white and a black version, but anything similar e.g. simply inverting it would do the trick, too.
[Updated on: Tue, 10 April 2018 18:04] by Moderator
|
|
|
|
Re: Grid, Template and selected row image [message #1785240 is a reply to message #1785221] |
Wed, 11 April 2018 07:37   |
Eclipse User |
|
|
|
Thanks Ivan,
I'm trying to use client scripting, but I'm already stuck at the beginning. Seems my simple ClientListener is never called, i.e. I don't see any log output in the browser console.
Just for testing I've also added a simple selection listener. This way I can see the log output "test2" for each selection change, but no "test".
grid = new Grid(twoColum, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
viewer = new GridTableViewer(grid);
grid.setData(RWT.MARKUP_ENABLED, Boolean.TRUE);
grid.setItemHeight(ROW_HEIGHT);
Template template = new Template();
[ template stuff ]
grid.setData(RWT.ROW_TEMPLATE, template);
grid.addListener(SWT.Selection, new Listener()
{
@Override
public void handleEvent(final Event event)
{
JavaScriptExecutor executor = RWT.getClient().getService(JavaScriptExecutor.class);
executor.execute("console.log(\"test2\");");
}
});
grid.addListener(SWT.Selection,
new ClientListener("function handleEvent(event){console.log(\"test\"); };"));
|
|
|
|
|
Re: Grid, Template and selected row image [message #1785577 is a reply to message #1785520] |
Tue, 17 April 2018 02:50  |
Eclipse User |
|
|
|
Thanks for checking.
Anyways I found a way to switch the images using a simple SelectionListener, even though it is called after the selection has changed. So the downside is that you can see a minor time difference between the text and image changes.
Still good enough to continue with other stuff. ;)
|
|
|
Powered by
FUDForum. Page generated in 0.03930 seconds