Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » How can I create a "Group" with no space for the title?
How can I create a "Group" with no space for the title? [message #467173] Thu, 26 January 2006 03:03 Go to next message
Edward Kuns is currently offline Edward KunsFriend
Messages: 14
Registered: July 2009
Junior Member
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 05:31 Go to previous message
Edward Kuns is currently offline Edward KunsFriend
Messages: 14
Registered: July 2009
Junior Member
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
Previous Topic:How do you set the background image on a Control (in 3.2 M4?)
Next Topic:Combo boxes on forms
Goto Forum:
  


Current Time: Tue Oct 22 20:03:06 GMT 2019

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

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

Back to the top