|
Re: CTabFolder minimize [message #453903 is a reply to message #453538] |
Wed, 13 April 2005 17:21 |
Veronika Irvine Messages: 1272 Registered: July 2009 |
Senior Member |
|
|
You also need to manage the size of the children. Have a look at the
following snippet:
http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.sni ppets/src/org/eclipse/swt/snippets/Snippet165.java?rev=HEAD& amp;content-type=text/vnd.viewcvs-markup
With a SashForm, minimize does not make too much sense. You would need to
be able to disable the sashes when one of the children was minimized and
there is no API to do this. Maximize, however does work very well with
SashForm:
public static void main (String [] args) {
Display display = new Display ();
final Shell shell = new Shell (display);
shell.setLayout(new FillLayout());
final SashForm form = new SashForm(shell, SWT.BORDER |
SWT.VERTICAL);
final CTabFolder folder1 = new CTabFolder(form, SWT.BORDER);
folder1.setMaximizeVisible(true);
CTabItem itemA = new CTabItem(folder1, SWT.NONE);
itemA.setText("Item A");
itemA.setControl(new Text(folder1, SWT.BORDER | SWT.MULTI |
SWT.H_SCROLL | SWT.V_SCROLL));
folder1.setSelection(0);
final CTabFolder folder2 = new CTabFolder(form, SWT.BORDER);
folder2.setMaximizeVisible(true);
CTabItem itemB = new CTabItem(folder2, SWT.NONE);
itemB.setText("Item B");
itemB.setControl(new Text(folder2, SWT.BORDER | SWT.MULTI |
SWT.H_SCROLL | SWT.V_SCROLL));
folder2.setSelection(0);
folder1.addCTabFolder2Listener(new CTabFolder2Adapter() {
public void restore(CTabFolderEvent event) {
folder1.setMaximized(false);
form.setMaximizedControl(null);
}
public void maximize(org.eclipse.swt.custom.CTabFolderEvent
event) {
folder1.setMaximized(true);
form.setMaximizedControl(folder1);
}
});
folder2.addCTabFolder2Listener(new CTabFolder2Adapter() {
public void restore(CTabFolderEvent event) {
folder2.setMaximized(false);
form.setMaximizedControl(null);
}
public void maximize(org.eclipse.swt.custom.CTabFolderEvent
event) {
folder2.setMaximized(true);
form.setMaximizedControl(folder2);
}
});
shell.open ();
while (!shell.isDisposed ()) {
if (!display.readAndDispatch ()) display.sleep ();
}
display.dispose ();
}
"kiran" <bkiran123@yahoo.com> wrote in message
news:5ecfd9cfdc8d3ba8801ed7d93633ae03$1@www.eclipse.org...
>
> Hi,
>
> I am using CTabFolder as top and bottom composites in a SashFrom within a
> standalone application. When I set the "CTabFolder.setMinimized( true )"
> in the lower CTabFolder, I could see the minimize icon in the top-right
> corner for the corresponding CTabFolder.
> Inside the action listener's minimize method I have the code as follows
>
> public void minimize( CTabFolderEvent event ) {
> if ( !bottomTabFolder.getMinimized() ) {
> tabsForm.setMaximizedControl( topTabFolder );
> bottomTabFolder.setMinimized( true );
> } else {
> tabsForm.setMaximizedControl( null );
> bottomTabFolder.setMinimized( false );
> }
> }
>
> when clicking on the minimize "-" button, the topTabFolder is occupying
> the complete SashForm, but I am not able to see the tabs portion of the
> bottomTabFolder as in eclipse views. Instead the bottomTabFolder is
> completely hidden and I cannot restore it.
>
> Can anyone guide me where I am going wrong with this functionality.
>
> Thanks,
> kiran
>
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.02769 seconds