Skip to main content



      Home
Home » Newcomers » Newcomers » Resizing problem driving a newb nuts !
Resizing problem driving a newb nuts ! [message #93379] Mon, 08 August 2005 16:27
Eclipse UserFriend
Originally posted by: freshtasty.hotmail.com

Hi,

I've bin stuck with the following resizing problem for weeks and I can't
seem to find a solution nor the reason. I have an SWT/JFace
ApplicationWindow containing a ScrolledComposite that holds a Composite
having a StackLayout. The goal is to be able to stack within a
ScrolledComposite.

A Goto... Menu Actions adds composites to the StackLayout, but right
now, only my search Composite is giving me an headache. The search
Composite has a search Button that dynamically displays the results
(equipments) within Tabs. After insertion of a new Tab, I do a
getShell().pack(true); but for some reason, only the outer
ApplicationWindow resizes correctly and not what is within the StackLayout.

To better understand, I've added to this post a stripped version of my
search
application with three classes: the ApplicationWindow (v_navigator), the
search Composite (v_search) and the search results Composite (v_equipment).
The code is really simple.

If anyone can free me from my desperation I would truly appreciate.

Sebastien
P.S. Three classes follow

/*********************************************************** ****************
**
Navigator
************************************************************ ****************
**/
package navigator;

import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.StatusLineManager;
import org.eclipse.jface.action.ToolBarManager;
import org.eclipse.jface.window.ApplicationWindow;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.swt.custom.StackLayout;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

public class V_NavigatorCIP extends ApplicationWindow {
private Action actEquipment;
private ScrolledComposite scrolledContainerAppl;
private Composite containerAppl;

public V_NavigatorCIP() {
super(null);
createActions();
addToolBar(SWT.FLAT | SWT.WRAP);
addMenuBar();
addStatusLine();
}

protected Control createContents(Composite parent) {
// Le scrolled composite ne peut pas contenir de layout car c'est le
// layout
// listner qui s'en occupe pour les redimensionnements.
scrolledContainerAppl = new ScrolledComposite(parent, SWT.V_SCROLL
| SWT.BORDER | SWT.H_SCROLL);
scrolledContainerAppl.setAlwaysShowScrollBars(true);
scrolledContainerAppl.setExpandHorizontal(true);
scrolledContainerAppl.setExpandVertical(false);

containerAppl = new Composite(scrolledContainerAppl, SWT.NONE);
final StackLayout stackLayout = new StackLayout();
containerAppl.setLayout(stackLayout);
containerAppl.setSize(containerAppl.computeSize(SWT.DEFAULT,
SWT.DEFAULT));
scrolledContainerAppl.setContent(containerAppl);

return scrolledContainerAppl;
}

private void createActions() {
{
actEquipment = new Action("Equipment") { //$NON-NLS-1$
public void run() {
showEquipment(containerAppl);
}
};
actEquipment.setAccelerator(SWT.CTRL | 'E');
actEquipment.setToolTipText("Goto ..."); //$NON-NLS-1$
}
}

protected MenuManager createMenuManager() {
MenuManager menuPrincipal = new MenuManager("menu"); //$NON-NLS-1$
{
final MenuManager menuAllerA = new MenuManager("Goto ...");
menuAllerA.add(actEquipment);
menuPrincipal.add(menuAllerA);
}
return menuPrincipal;
}

protected ToolBarManager createToolBarManager(int style) {
ToolBarManager toolBarManager = new ToolBarManager(style);
return toolBarManager;
}

protected StatusLineManager createStatusLineManager() {
StatusLineManager statusLineManager = new StatusLineManager();
statusLineManager.setMessage(null, "");
return statusLineManager;
}

public static void main(String args[]) {
try {
V_NavigatorCIP window = new V_NavigatorCIP();
window.setBlockOnOpen(true);
window.open();
Display.getCurrent().dispose();
} catch (Exception e) {
e.printStackTrace();
}
}

protected void configureShell(Shell newShell) {
super.configureShell(newShell);
newShell.setText("New Application");
}

protected Point getInitialSize() {
return new Point(500, 375);
}

private void showEquipment(Composite container){
V_Search searchComposite = new V_Search(container, SWT.NONE);
StackLayout sl = (StackLayout) containerAppl.getLayout();
sl.topControl = searchComposite;
// C'est le conteneur qui doit ex
Previous Topic:Any fix for broken Help system?
Next Topic:Resizing problem driving a newb nuts !
Goto Forum:
  


Current Time: Thu Jul 10 00:13:09 EDT 2025

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

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

Back to the top