Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 377961 - A combo in a toolbar gets shrunk
Summary: A combo in a toolbar gets shrunk
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.2   Edit
Hardware: PC Linux-GTK
: P3 major (vote)
Target Milestone: 4.2.1   Edit
Assignee: Bogdan Gheorghe CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 369570
  Show dependency tree
 
Reported: 2012-04-27 14:46 EDT by Paul Webster CLA
Modified: 2012-08-01 17:41 EDT (History)
6 users (show)

See Also:
Silenio_Quarti: review+


Attachments
Patch for ToolItem (1.90 KB, patch)
2012-06-06 16:38 EDT, Bogdan Gheorghe CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Webster CLA 2012-04-27 14:46:26 EDT
The combo boxes placed in the editor toolbar for the ecorediag editor get set to 1 pixel wide.

Walked through it with Bogdan, but a SWT.SEPARATOR toolitem called with toolItem.setWidth(223) seems to get its width reset on the parent (ToolBar) relayout().

The ToolItem.getBounds() returns a width of 1.  Something similar to this can be seen in Snippet58 if the combo/toolitem code sets the control first and the width second.

	combo.select(1);
	combo.pack ();
	sep.setControl (combo);
	sep.setWidth (combo.getSize ().x);

PW
Comment 1 Paul Webster CLA 2012-05-08 12:23:40 EDT
See also bug 378847

PW
Comment 2 Bogdan Gheorghe CLA 2012-06-06 16:25:31 EDT
The behavior of the snippet is correct: when setControl is called with the combo, the toolbar sizes it to the size of the separator (which has not been set yet). The separator should be sized before setting the control (or the combo getSize needs to run before it gets hammered).

But this is not the cause of this bug.

ToolItem does not call gtk_widget_size_allocate after calling set_size_request, which is needed when setting a new size on a handle. Attaching a patch...
Comment 3 Bogdan Gheorghe CLA 2012-06-06 16:38:47 EDT
Created attachment 216971 [details]
Patch for ToolItem
Comment 4 Bogdan Gheorghe CLA 2012-08-01 17:41:56 EDT
Patch released to master, 4.2 maintenance and 3.8 maintenance.