How can I create a "Group" with no space for the title? [message #467173] |
Wed, 25 January 2006 22:03  |
Eclipse User |
|
|
|
I previously asked this question and got no responses, so I'll ask in a
different way. I want to have a group, but I don't want a title -- just
a scribed line around a group of widgets. The Group appears to require
the space for a title even if you have no title and don't want to use 10
pixels (+/-) for space for a title. Would the correct way of doing this
to be create (instead of a Group) a Composite and then draw on the GC of
that Composite?
I've searched for examples and so far have not found any examples of
anyone doing this with SWT. Maybe I'm missing something obvious.
Control (and thus Composite) has the style hint BORDER, but I don't see
anything to hint or control what KIND of border is drawn. There's a
method for getBorderWidth() but nothing to set the border width.
Does anyone know how to do what I am trying to do?
Thanks
Eddie
|
|
|
Re: How can I create a "Group" with no space for the title? [message #467177 is a reply to message #467173] |
Thu, 26 January 2006 00:31  |
Eclipse User |
|
|
|
I found part of a custom answer by fiddling -- I have the following
Listener and I add an instance of this listener for Event SWT.Paint to
every Composite that I want to have a border around it.
public final class GroupBorderPainter implements Listener {
public void handleEvent(Event e) {
Composite composite = (Composite) e.widget;
Point size = composite.getSize();
GC gc = e.gc;
gc.setForeground(black);
gc.drawRoundRectangle(0, 0, size.x-1, size.y-1, 10, 10);
}
}
where "black" is formed by:
black = new Color(display, new RGB(0,0,0));
Is this a reasonable way to go about this? Is this guaranteed to be
stable across mouse and keyboard actions, redraws, and so on?
There is only one problem with this, which is that I want to set the
area outside the border to the background color of the parent, not leave
it at the background color of the Composite.
Thanks,
Eddie
|
|
|
Powered by
FUDForum. Page generated in 0.03487 seconds