Bug 79631 - [CTabFolder] Min / Max buttons are hidden when last item closed
Summary: [CTabFolder] Min / Max buttons are hidden when last item closed
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Veronika Irvine CLA
QA Contact:
URL:
Whiteboard:
Keywords: ui
Depends on:
Blocks:
 
Reported: 2004-11-27 15:49 EST by Benjamin Pasero CLA
Modified: 2005-05-09 18:23 EDT (History)
0 users

See Also:


Attachments
Error #1 and #2 (12.35 KB, image/jpeg)
2005-05-07 07:43 EDT, Benjamin Pasero CLA
no flags Details
Patch that fixes problems for me (1.70 KB, patch)
2005-05-08 07:46 EDT, Benjamin Pasero CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Benjamin Pasero CLA 2004-11-27 15:49:07 EST
Hi,

using Snippet 165 to show a CTabFolder with Min / Max Buttons and some
CTabItems, some strange things happen on my system:

1.) Close all CTabItems. The CTabFolder becomes empty.

2.) Hover over the place Min and Max items should be. See that they
are clickable and the tooltip shows, although the buttons are not
visible.

-> I think those buttons should be visible even in case the last CTabItem
is closed.

1.) Minimize the CTabFolder using the minimize button

2.) Close all Tabs. I am getting a small graphic bug. A few pixel of the last
closed CTabItem is still visible.

Ben
Comment 1 Benjamin Pasero CLA 2005-03-25 08:40:09 EST
Still showing in latest SWT.
Comment 2 Benjamin Pasero CLA 2005-05-06 05:13:50 EDT
Is this adressed for M7?
Comment 3 Veronika Irvine CLA 2005-05-06 09:55:58 EDT
I just released the code for this in HEAD.  It will affect the Eclipse editor 
workbook so I am not sure if they will object.  It may end up coming back 
out.  The argument that they might present is that it is visually too 
cluttered.

Currently in HEAD, the min and max buttons show even if there are no 
CTabItems.  The height of the tab area defaults to the height of a tab with 
text only (i.e. it is based on font height).  If you add a tab with an image 
this may cause the header height to increase.  If you delete all the tabs, the 
header height does not go back to the default height - it stays at the height 
it had when the last tab was open.  This is based on the assumption that new 
tabs will have the same height as the old tabs and we want to minimize jumping 
around.
Comment 4 Benjamin Pasero CLA 2005-05-07 07:41:33 EDT
I am seeing some new problems using latest nightly:

- Closing the last CTabItem from the CTabFolder does not remove the horizontal
separator, see Screenshot #1

- Even if not CTabItem is visible in the CTabFolder, I am seeing the horizontal
separator and the Maximize Button if I am setting a Font to the CTabFolder, see
Screenshot #2

Snippet for #2:

public class Main {
  public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new Shell(display);

    FillLayout fill = new FillLayout();
    fill.marginHeight = 10;
    fill.marginWidth = 10;

    shell.setLayout(fill);

    Composite c = new Composite(shell, SWT.BORDER);
    c.setLayout(fill);

    CTabFolder tabFolder = new CTabFolder(c, SWT.CLOSE);
    tabFolder.setMaximizeVisible(true);
    tabFolder.setFont(new Font(display, "Helvetica", 10, SWT.NORMAL));

    shell.open();
    while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) {
        display.sleep();
      }
    }
  }
}
Comment 5 Benjamin Pasero CLA 2005-05-07 07:43:57 EDT
Created attachment 20800 [details]
Error #1 and #2
Comment 6 Benjamin Pasero CLA 2005-05-08 07:46:36 EDT
Created attachment 20810 [details]
Patch that fixes problems for me
Comment 7 Veronika Irvine CLA 2005-05-09 08:23:13 EDT
The horizontal line is intentional.  It delimits the tab area.

The error is that the tab height was not intitialized in the constructor of 
CTabFolder and was only updated when the font was set.  I have fixed this.  
Now the line appears as soon as the CTabFolder is created and the maximize 
button is visible as soon as it is set.
Comment 8 Benjamin Pasero CLA 2005-05-09 15:16:05 EDT
Hm ok, but I am not understanding why the separator line and maximize/minimize
controls should be visible, when the TabFolder is empty. Why should someone
maximize an empty Tabfolder?

The native TabFolder is not showing anything, expect for its native background
and border, when no TabItem is added.

Anyways, I am helping me with calling CTabFolder#setVisible(false) whenever the
number of tabitems inside the folder becomes zero.

Ben
Comment 9 Veronika Irvine CLA 2005-05-09 17:00:35 EDT
In your original bug report you say "-> I think those buttons should be 
visible even in case the last CTabItem is closed."  So that is what I 
implemented.  Perhaps I misunderstood.  If it makes sense to maximize/minimize 
the folder after you close the last item, then I presumed that it would make 
sense to maximize/minimize the folder before you open any items.
Comment 10 Benjamin Pasero CLA 2005-05-09 18:23:24 EDT
Oh, I wonder if I made a typo there or really wanted to have the buttons visible
in November. Sorry, I thought this was about hiding the Max/Min Button while
having no Items in the TabFolder. 

Anyways, I am pretty happy now :). And I think you already agreed that the
current solution is better working in Eclipse.

Keep up the good work, 
Ben