Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Possible Bug in SearchDialogs TabFolderLayout ?
Possible Bug in SearchDialogs TabFolderLayout ? [message #456395] Thu, 02 June 2005 10:12 Go to next message
Harald Kuhn is currently offline Harald KuhnFriend
Messages: 4
Registered: July 2009
Junior Member
Hi,

I added a custom ISearchPage into the eclipse SearchDialog. Inside this
page, search criteria can be added through a button. If more than a number
of this criterias is added, the page should not resize but offer a
scrollbar. This works fine as long as the search page is not changed.
After switching to another page and back, my search page gets the full
size of the composite inside the scrollbar showing all criteria.

I had a look at SearchDialog and its inner class TabFolderLayout. In its
computeSize Method TabFolderLayout iterates over all children of a
composite to determine the size of the biggest child and returns this as
the size of this composite. But imho, this is not the behavier wanted when
a ScrolledComposite is involved?

Also does anybody know a way to prevent this behavier for
ScrolledComposites ?

Harald
Re: Possible Bug in SearchDialogs TabFolderLayout ? [message #456439 is a reply to message #456395] Fri, 03 June 2005 16:30 Go to previous messageGo to next message
Veronika Irvine is currently offline Veronika IrvineFriend
Messages: 1272
Registered: July 2009
Senior Member
You could place the ScrolledComposite inside a Composite before addign it to
the TabFolder.

Give the Composite a GridLayout and for the GridData of the
ScrolledComposite set the widthHint and heightHint to values you feel are
reasonable.

e.g.

public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
shell.setLayout(new FillLayout());
TabFolder folder = new TabFolder(shell, SWT.NONE);
TabItem item = new TabItem(folder, SWT.NONE);
Composite c = new Composite(folder, SWT.NONE);
item.setControl(c);
GridLayout layout = new GridLayout(1, false);
layout.marginWidth = layout.marginHeight = 0;
c.setLayout(layout);
ScrolledComposite sc = new ScrolledComposite(c, SWT.H_SCROLL |
SWT.V_SCROLL);
GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
data.widthHint = 300;
data.heightHint = 400;
sc.setLayoutData(data);
Label l = new Label(sc, SWT.BORDER | SWT.CENTER);
l.setText("content");
l.setBackground(display.getSystemColor(SWT.COLOR_RED));
l.setSize(600, 800);
sc.setContent(l);

shell.pack();
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}


"Harald" <harald@docufy.de> wrote in message
news:96593dc5a6b53e7adf1278f4cb2e4a6c$1@www.eclipse.org...
> Hi,
>
> I added a custom ISearchPage into the eclipse SearchDialog. Inside this
> page, search criteria can be added through a button. If more than a number
> of this criterias is added, the page should not resize but offer a
> scrollbar. This works fine as long as the search page is not changed.
> After switching to another page and back, my search page gets the full
> size of the composite inside the scrollbar showing all criteria.
>
> I had a look at SearchDialog and its inner class TabFolderLayout. In its
> computeSize Method TabFolderLayout iterates over all children of a
> composite to determine the size of the biggest child and returns this as
> the size of this composite. But imho, this is not the behavier wanted when
> a ScrolledComposite is involved?
>
> Also does anybody know a way to prevent this behavier for
> ScrolledComposites ?
>
> Harald
>
Re: Possible Bug in SearchDialogs TabFolderLayout ? [message #456807 is a reply to message #456439] Thu, 09 June 2005 07:52 Go to previous message
Harald Kuhn is currently offline Harald KuhnFriend
Messages: 4
Registered: July 2009
Junior Member
Setting the GridData hint fields did the trick.
Thanks you very much for the help.

Harald
Previous Topic:Listening on 2 ports same time from SWT APP.
Next Topic:Cannot set background on Button
Goto Forum:
  


Current Time: Mon Sep 23 19:42:42 GMT 2024

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

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

Back to the top