Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » How to create scrollcomposite for only one tabItem
How to create scrollcomposite for only one tabItem [message #1732596] Wed, 18 May 2016 05:28 Go to next message
karthik krishnamoorthy is currently offline karthik krishnamoorthyFriend
Messages: 17
Registered: May 2016
Junior Member
I am trying the following code to set scrollcomposite for TabItem "item2". But couldn't get the scroll bar.

Here i created two tabItem , where I need to set scrollcomposite / scrollbar for only item2 not for item1

Display display = new Display();
final Shell shell = new Shell(display);
final TabFolder tabFolder = new TabFolder(shell, SWT.BORDER);
Rectangle clientArea = shell.getClientArea();
tabFolder.setLocation(clientArea.x, clientArea.y);
// First Tab Item
TabItem item = new TabItem(tabFolder, SWT.NONE);
item.setText("TabItem " + 1);
Composite comp = new Composite(tabFolder, SWT.NONE);
GridLayout gl = new GridLayout();
GridData wgd = new GridData(GridData.FILL_BOTH);
comp.setLayout(gl);
comp.setLayoutData(wgd);
Button button = new Button(comp, SWT.PUSH);
button.setText("Page " + 1);
Button button2 = new Button(comp, SWT.PUSH);
button2.setText("Page " + 1);
Button button3 = new Button(comp, SWT.PUSH);
button3.setText("Page " + 1);
Button button4 = new Button(comp, SWT.PUSH);
button4.setText("Page " + 1);
item.setControl(comp);

ScrolledComposite sc = new ScrolledComposite(tabFolder, SWT.BORDER
| SWT.H_SCROLL | SWT.V_SCROLL);

// second tab item
TabItem item2 = new TabItem(tabFolder, SWT.NONE);
item2.setText("TabItem " + 1);
Composite comp2 = new Composite(tabFolder, SWT.NONE);
GridLayout gl2 = new GridLayout();
GridData wgd2 = new GridData(GridData.FILL_BOTH);
comp2.setLayout(gl2);
comp2.setLayoutData(wgd2);
Button buttonq = new Button(comp2, SWT.PUSH);
buttonq.setText("Page " + 1);
Button button2q = new Button(comp2, SWT.PUSH);
button2q.setText("Page " + 1);

sc.setContent(comp2);
sc.setExpandHorizontal(true);
sc.setExpandVertical(true);
sc.setMinSize(comp2.computeSize(SWT.DEFAULT, SWT.DEFAULT));
sc.setShowFocusedControl(true);
item2.setControl(comp2);

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

when i added following code, tabItem2 was empty . `item2.setControl(comp2);`

Please help me to solve this
Re: How to create scrollcomposite for only one tabItem [message #1732607 is a reply to message #1732596] Wed, 18 May 2016 13:28 Go to previous messageGo to next message
Erdal Karaca is currently offline Erdal KaracaFriend
Messages: 854
Registered: July 2009
Senior Member
You do not have an initial tab item selected for your tab folder.
See TabFolder.setSelection(...)
Re: How to create scrollcomposite for only one tabItem [message #1732669 is a reply to message #1732607] Thu, 19 May 2016 04:57 Go to previous message
karthik krishnamoorthy is currently offline karthik krishnamoorthyFriend
Messages: 17
Registered: May 2016
Junior Member
could you please elaborate the code
Previous Topic:Application menu initially not shown when launched on Mac platform
Next Topic:Behavioural differences of redraw() between Win7 and Win10
Goto Forum:
  


Current Time: Tue Mar 19 05:53:16 GMT 2024

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

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

Back to the top