Bug 71207 - [Widgets] Add option to fill ToolItems in vertical ToolBar to fit width
Summary: [Widgets] Add option to fill ToolItems in vertical ToolBar to fit width
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P4 enhancement with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact: Felipe Heidrich CLA
URL:
Whiteboard:
Keywords: triaged
Depends on:
Blocks:
 
Reported: 2004-08-01 17:34 EDT by Chris Gross CLA
Modified: 2017-08-03 12:30 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Gross CLA 2004-08-01 17:34:56 EDT
When you create a ToolBar with the vertical style, the ToolItems will not span 
the entire width of the toolbar, creating a jagged and an unpolished look 
(IMO).  You can see this behavior in Eclipse itself if you dock the perspective 
toolbar on the left.  Can we please have an option to size the toolitems all to 
the maximum width?
Comment 1 Steve Northover CLA 2004-08-04 18:39:50 EDT
It looks like Windows won't let you do this (after all the hacking we just 
did, fighting with the tool bar).  FH to investigate (low priority?).
Comment 2 Felipe Heidrich CLA 2004-08-05 16:33:37 EDT
I'm not sure how to implement it. low priority (enhancement).

Here is some code (win32 specific) I was playing with:
public static void main(String[] args) {
	final Display display= new Display();
	final Shell shell= new Shell(display);
	final ToolBar toolBar= new ToolBar(shell, SWT.VERTICAL |SWT.BORDER | 
SWT.FLAT);
	int TB_SETBUTTONWIDTH = 0x400 + 59;//0X43B
	int width = 100 + (101 << 16);	
	org.eclipse.swt.internal.win32.OS.SendMessage(toolBar.handle, 
TB_SETBUTTONWIDTH, 0, width);//doesn't do anything
	new ToolItem (toolBar, SWT.PUSH).setText("Plus");
	new ToolItem (toolBar, SWT.SEPARATOR);
	new ToolItem (toolBar, SWT.PUSH).setText("Java Perspect");
	new ToolItem (toolBar, SWT.PUSH).setText("CVS Perspect");
	new ToolItem (toolBar, SWT.PUSH).setText("Debug Perspect");
	toolBar.pack();
	
	shell.addListener(SWT.MouseDown, new Listener() {
		public void handleEvent(Event event) {
			ToolItem[] items = toolBar.getItems();
			int width = 0;
			for (int i= 0; i < items.length; i++) {
				ToolItem item = items[i];
				int w = item.getBounds().width;
				if (w > width) width = w;
			}
			TBBUTTONINFO info = new TBBUTTONINFO ();
			info.cbSize = TBBUTTONINFO.sizeof;
			info.dwMask = OS.TBIF_SIZE;
			info.cx = (short) width;
			int hwnd = toolBar.handle;
			for (int i= 0; i < items.length; i++) {
				OS.SendMessage (hwnd, OS.TB_SETBUTTONINFO, i, 
info);
			}
			
		}
	});
	shell.open();
	while (!shell.isDisposed()) {
		if (!display.readAndDispatch())
			display.sleep();
	}
}
Comment 3 Steve Northover CLA 2007-06-20 09:12:06 EDT

*** This bug has been marked as a duplicate of bug 139318 ***
Comment 4 Steve Northover CLA 2007-06-20 09:12:55 EDT
Oops, not a dup.
Comment 5 Felipe Heidrich CLA 2009-08-14 08:57:47 EDT
Your bug has been moved to triage, visit http://www.eclipse.org/swt/triage.php for more info.
Comment 6 Leo Ufimtsev CLA 2017-08-03 12:30:29 EDT
This is a one-off bulk update. (The last one in the triage migration).

Moving bugs from swt-triaged@eclipse to platform-swt-inbox@eclipse.org and adding "triaged" keyword as per new triage process:
https://wiki.eclipse.org/SWT/Devel/Triage

See Bug 518478 for details.

Tag for notification/mail filters:
@TriageBulkUpdate