Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Section in Form Page is Collapsed(SWT)
Section in Form Page is Collapsed [message #758688] Thu, 24 November 2011 09:16 Go to next message
Vinod Kannur is currently offline Vinod KannurFriend
Messages: 7
Registered: October 2011
Junior Member
Hi,

I have a created the Form view page using Eclipse Plug-gin with a view.I am trying to run a Form View Page, but Sections are collapsed on my first display.
I have set the property of Section as Expanded but its not getting reflected. If I again click on the section, it will expand and will display the contents.


Please find the code snippet for the Form View Page.

public class View extends ViewPart {
	private final FormToolkit formToolkit = new FormToolkit(Display.getDefault());
	private Text txtEemv;
public View() {
	}
	public static final String ID = "example2.view";
	
	class ViewContentProvider implements IStructuredContentProvider {
		public void inputChanged(Viewer v, Object oldInput, Object newInput) {
		}

		public void dispose() {
		}

		public Object[] getElements(Object parent) {
			if (parent instanceof Object[]) {
				return (Object[]) parent;
			}
	        return new Object[0];
		}
	}

	class ViewLabelProvider extends LabelProvider implements
			ITableLabelProvider {
		public String getColumnText(Object obj, int index) {
			return getText(obj);
		}

		public org.eclipse.swt.graphics.Image getColumnImage(Object obj, int index) {
			return getImage(obj);
		}

		public org.eclipse.swt.graphics.Image getImage(Object obj) {
			return PlatformUI.getWorkbench().getSharedImages().getImage(
					ISharedImages.IMG_OBJ_ELEMENT);
		}
	}

	@Override
	public void createPartControl(Composite parent) {
		
		TabFolder tabFolder = new TabFolder(parent, SWT.BOTTOM);
		formToolkit.adapt(tabFolder);
		formToolkit.paintBordersFor(tabFolder);
final ScrolledForm scrldfrmNewScrolledform = formToolkit.createScrolledForm(tabFolder);
		scrldfrmNewScrolledform.setShowFocusedControl(true);
		tbtmEemv_1.setControl(scrldfrmNewScrolledform);
Section sctnCatalogEntry = formToolkit.createSection(scrldfrmNewScrolledform.getBody(),Section.EXPANDED| Section.TWISTIE| Section.TITLE_BAR);
		sctnCatalogEntry.setVisible(true);
		sctnCatalogEntry.setEnabled(true);
		sctnCatalogEntry.setExpanded(true);
		sctnCatalogEntry.setBounds(10, 276, 365, 124);
		formToolkit.paintBordersFor(sctnCatalogEntry);
		sctnCatalogEntry.setText("Catalog Entry");
		sctnCatalogEntry.setToolTipText("Catalog Information");
Composite composite_2 = new Composite(sctnCatalogEntry, SWT.Expand);
		formToolkit.adapt(composite_2);
		formToolkit.paintBordersFor(composite_2);
		sctnCatalogEntry.setClient(composite_2);
		
		org.eclipse.swt.widgets.Label lblNewLabel_3 = new org.eclipse.swt.widgets.Label(composite_2, SWT.NONE);
		lblNewLabel_3.setBounds(7, 10, 84, 15);
		formToolkit.adapt(lblNewLabel_3, true, true);
		lblNewLabel_3.setText("Item Title :");
		
		txtContractToCash_1 = new Text(composite_2, SWT.BORDER);
		txtContractToCash_1.setBounds(102, 7, 241, 21);
		txtContractToCash_1.setText("Contract to Cash");
		formToolkit.adapt(txtContractToCash_1, true, true);
}
public void setFocus() {
	}
	
	public void dispose() {
		formToolkit.dispose();
		super.dispose();
	}
}


Can you please let me know what could be reason and how can I render when I run for the first time?
index.php/fa/6236/0/

Thanks
-Vinod

Re: Section in Form Page is Collapsed [message #758720 is a reply to message #758688] Thu, 24 November 2011 11:43 Go to previous messageGo to next message
Vijay RajFriend
Messages: 608
Registered: July 2009
Senior Member
I am curious to know ,why have you not used any layout in your application?

any way...
this code
                sctnCatalogEntry.setVisible(true);
		sctnCatalogEntry.setEnabled(true);
		sctnCatalogEntry.setExpanded(true);


should be after setting the text and bounds etc



---------------------
why, mr. Anderson, why, why do you persist?
Because I Choose To.
Regards,
Vijay
Re: Section in Form Page is Collapsed [message #758741 is a reply to message #758720] Thu, 24 November 2011 12:55 Go to previous message
Vinod Kannur is currently offline Vinod KannurFriend
Messages: 7
Registered: October 2011
Junior Member
I have used Window Builder to design the Form View Page. Thanks a ton Vijay. It worked. Smile

-Vinod

[Updated on: Thu, 24 November 2011 12:56]

Report message to a moderator

Previous Topic:Wait for Browser thread to return
Next Topic:embedded pdf, flash,... does not work in eclipse help with internal browser
Goto Forum:
  


Current Time: Wed Nov 26 10:25:31 GMT 2014

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

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