Skip to main content



      Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Possible Bug in SearchDialogs TabFolderLayout ?
Possible Bug in SearchDialogs TabFolderLayout ? [message #456395] Thu, 02 June 2005 06:12 Go to next message
Eclipse UserFriend
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 12:30 Go to previous messageGo to next message
Eclipse UserFriend
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 03:52 Go to previous message
Eclipse UserFriend
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: Tue Jul 08 08:41:19 EDT 2025

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

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

Back to the top