Bug 245569 - Use platform native or reasonable default for Combo's visibleItemCount
Summary: Use platform native or reasonable default for Combo's visibleItemCount
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.5   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.6 M7   Edit
Assignee: Silenio Quarti CLA
QA Contact:
URL:
Whiteboard:
Keywords: polish, usability
Depends on:
Blocks:
 
Reported: 2008-08-28 14:08 EDT by Markus Keller CLA
Modified: 2010-04-27 16:43 EDT (History)
8 users (show)

See Also:


Attachments
patch for win32 (1.55 KB, patch)
2010-03-22 12:29 EDT, Silenio Quarti CLA
no flags Details | Diff
patch for cocoa and carbon (2.03 KB, patch)
2010-03-22 12:30 EDT, Silenio Quarti CLA
no flags Details | Diff
patch for win32 to uses the screen height to determine the default visisble item count (2.18 KB, patch)
2010-03-29 13:47 EDT, Silenio Quarti CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2008-08-28 14:08:01 EDT
I20080827-0935

This is a follow-up to bug 7845. Combos are still a big pain point in SWT applications under Windows. Only few developers find and apply the hack from bug 7845 to make combos usable.

The only justification I've heard for keeping the non-native default visibleCount  at 5 was bug 7845 comment 12:
> Because 20 would be wrong in other situations?

However, the default visibleItemCount is already platform-dependent, and even non-controllable on some platforms. If some applications cannot live with a bigger default, they can always set a smaller value manually. But I cannot imagine any application where it is preferable to force to user to look through a small keyhole and scroll around with an 8 pixels high thumb.

I would set the default to 30 (as e.g. Windows Control Panels do), but I could live with any value >= 20.

Please just consider this as normal bug, fix it, and make 99.99% of all users of SWT applications happy.
Comment 1 Markus Keller CLA 2010-03-11 10:00:01 EST
Could you please fix this? Nobody could come up with a reason for this keyhole on Windows, and there are ample reasons for making it just work like on other platforms (GTK and the Mac have no artificial limits).

That's one small step for SWT, one giant leap for usability.
Comment 2 Felipe Heidrich CLA 2010-03-11 14:35:58 EST
In cocoa the native count is 5, in carbon it is 6, in GTK is many items as it can fit in the screen (getVisibleItemCount() returns 5 in GTK but it is lie).
In win32, as we know, it is 5 (non-native).

Silenio, how do you feel changing the default visible item count in cocoa/carbon/win32 to 20 ?
Comment 3 Markus Keller CLA 2010-03-11 17:26:56 EST
> In cocoa the native count is 5
Oh, sorry, I only checked read-only combos (those are unlimited).

Interestingly, Apple shows 10 items in editable Combos in the System Preferences. It would also make sense to set a bigger default on the Mac.
Comment 4 Felipe Heidrich CLA 2010-03-12 08:58:02 EST
the test code I used (tested only DROP_DOWN)
public static void main(String[] args) {
	final Display display = new Display();
	Shell shell = new Shell(display);
	shell.setLayout(new GridLayout());
	Combo combo = new Combo(shell, SWT.DROP_DOWN);
	for (int i = 0; i < 50; i++) {
		combo.add("item"+i);
	}
	System.out.println(combo.getVisibleItemCount());
	shell.setSize(200, 200);
	shell.open();
	while (!shell.isDisposed()) {
	if (!display.readAndDispatch())
		display.sleep();
	}
	display.dispose();
}
Comment 5 Silenio Quarti CLA 2010-03-12 10:42:18 EST
I searched through some apps on Windows and Mac:

FileExplorer Address combo: 15
Printer Page Setup: >13
Font dialog: 7
Run dialog in start menu: >15;
Excel/Word font name combo: 12
Excel/Word font size combo: 12
Date & Time Closest City on mac: 10
Display Resolutions on mac: 10

I guess there is no real standard here. My vote is to change all platforms to 15. Or mac to 10 and windows/gtk to 15. I have no stronge feelings about either.
Comment 6 Markus Keller CLA 2010-03-15 06:02:47 EDT
> FileExplorer Address combo: 15
That's quite a special case, since it mainly shows the parent folders of the current folder, so the list is often not that big.

> Font dialog: 7
The only combos I see there are Color and Script, and they are both unlimited (16 and 9 items on my system)

> Excel/Word font name combo: 12
> Excel/Word font size combo: 12
I hope we agree that those are UI bloopers. MS was probably scared that the custom font preview rendering was not fast enough. Even the font combo in WordPad shows 30 items.

And all the options in the Control Panels (e.g. Regional options) show 30 as well.

So the most commonly used size on Windows (XP) is 30.
Comment 7 Martin Oberhuber CLA 2010-03-19 12:23:23 EDT
+1 for any visibleItemCount larger than 5 (which is just painful).
Comment 8 Silenio Quarti CLA 2010-03-22 11:56:22 EDT
(In reply to comment #6)
> > FileExplorer Address combo: 15
> That's quite a special case, since it mainly shows the parent folders of the
> current folder, so the list is often not that big.

In my machine, the list is always big (around 30 items). I believe the file explorer is the most common app on Windows. That is why I suggested 15 as the default value.

> > Font dialog: 7
> The only combos I see there are Color and Script, and they are both unlimited
> (16 and 9 items on my system)

I am talking about the the "Font", "Font Style" and "Size" combos. They are SWT.SIMPLE style combos. We should not increase the visibleCount for these kind of combos, since it would take to much space in a dialog.

> And all the options in the Control Panels (e.g. Regional options) show 30 as
> well.
> So the most commonly used size on Windows (XP) is 30.

I could argue this is just one case, but the same goes for my FileExplorer case. 

Anyways, we all agree that 5 is too small, but the limit is really application specific. So applications that care about how many items are visible should call setVisibleCount(). I will write a patch that changes the limit to 15 on Windows and 10 on Mac and also take into consideration the SWT.SIMPLE style.
Comment 9 Silenio Quarti CLA 2010-03-22 12:13:43 EDT
The visible count on Motif is 10. I am not going to change that value.
Comment 10 Silenio Quarti CLA 2010-03-22 12:29:45 EDT
Created attachment 162691 [details]
patch for win32
Comment 11 Silenio Quarti CLA 2010-03-22 12:30:46 EDT
Created attachment 162692 [details]
patch for cocoa and carbon
Comment 12 Markus Keller CLA 2010-03-22 12:50:23 EDT
I agree that the default for SWT.SIMPLE-style Combos should stay small.

Re the File Explorer address "Combo": That may be reminiscence of the days of 13" monitors. Today, it's just a UI blooper.

Have you ever thought: "Thank heavens that they only show me 15 items and not all the 30 at once. Finally I can put my scroll wheel into good use!". I haven't. Ever.

Nowadays, even the Microsoft User Experience Guidelines recommend 30 items:
http://msdn.microsoft.com/en-us/library/aa511458%28v=MSDN.10%29.aspx#DropDownLists44 :
"Choose a list length that eliminates unnecessary vertical scrolling. Because drop-down lists are displayed on demand, their lists should show up to 30 items."
Comment 13 Silenio Quarti CLA 2010-03-22 14:45:53 EDT
Ok, 30 it is.

Fixed > 20100322
Comment 14 Silenio Quarti CLA 2010-03-29 13:42:23 EDT
We have to revisit this. If we have a fixed number of visible items that high, we will have problems in small resolution screens (like WinCE). The list will be bigger than the screen height. I believe the list height should be a percentage of the screen height. I am going to attach a patch that makes the list height 1/3 of the screen. This looks like a reasonable size to me and it is actually 30 items a my screen (1600x1200).
Comment 15 Silenio Quarti CLA 2010-03-29 13:47:23 EDT
Created attachment 163307 [details]
patch for win32 to uses the screen height to determine the default visisble item count
Comment 16 Markus Keller CLA 2010-03-29 14:54:53 EDT
(In reply to comment #14)
I agree. At least WinXP behaves badly when the popup and the text area need to overlap because there's no space.

And thanks a lot for fixing this bug!
Comment 17 Silenio Quarti CLA 2010-03-29 17:25:25 EDT
Fixed > 20100329