Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsAligning button text to the left, yet expand button?
https://www.eclipse.org/forums/index.php/mv/msg/166625/528245/#msg_528245
parent: Composite w/ FillLayout(horizontal)
scroll: ScrolledComposite w/ RowLayout(vertical)
child: Composite w/ GridLayout(2,true)
The buttons are added to the child composite. The problem is that the columns of buttons do not display as equal width. The buttons with less text are shorter, and the buttons with more text are longer.
The only way I was able to get them to be the same width was to use a GridData on each button, and to set the widthHint of the GridData to the same large value on every button. Now the buttons are the same width.
However, the buttons have images and the images and the button text move to the center of the button, and now the images do not line up. Maybe I can show this below:
What I have:
____________________
| Image 1 LargeText1 |
|____________________|
Notice that in the second case (What I want), the buttons are the same size, but the images and the beginning of the text line up vertically.
Is there any way to achieve the 2nd case?
Thanks.
]]>Herb Miller2010-04-19T19:37:17-00:00Re: Aligning button text to the left, yet expand button?
https://www.eclipse.org/forums/index.php/mv/msg/166625/528250/#msg_528250
Maybe this will work. Imagine that the small x's are blanks:
What I have:
____________________
| Image 1xxxxLargeText1xx|
|____________________|
]]>Herb Miller2010-04-19T19:42:31-00:00Re: Aligning button text to the left, yet expand button?
https://www.eclipse.org/forums/index.php/mv/msg/166625/528395/#msg_528395
composite is created with GridLayout(2,true)..creating 2 buttons will
align on the same row..
Can you provide us the snippet that would help me to understand the
problem better ?]]>Praveen 2010-04-20T11:42:42-00:00Re: Aligning button text to the left, yet expand button?
https://www.eclipse.org/forums/index.php/mv/msg/166625/528454/#msg_528454
I would like all of the buttons to be the same size, even if the text value for each button is of different lengths. I set the makeColumnsEqualWidth for the GridLayout to true. But for some reason, the buttons are not the same width. They stll vary their width based on the text.
I was able to get the buttons to be the same width by using a GridData on each button and setting the widthHint.
Using the widthHint did make all of the buttons the same width, but it centered the image attached to the button and it centered the text. I would like to keep the images and text on the left edge of the button.
My diagram (pitiful as it was) was trying to show just 1 column of the buttons, and how the text and images on the button did not line up.
If you need more, please let me know. The code is quite large. If I can pare it down to a small snippet, I will post it.