Splash
Splash

Reputation: 181

SWT button position after resizing

I'm working with SWT. I created a button, and it supposed to change its text after being pressed. The second text is wider than the first one, and the button does not being re-sized appropriately. so I used button.pack(), and setSize() functions. The real issue is actually with its alignment in the shell after this size changing. it's being expanded to the right instead to the left. I guess it's actually the normal behavior, but I'm not sure where to change it. I tried to change things by creating a gridData but it only did worse.

The button parent is tabFolder, and the last consists of a gridlayout with two uneven columns, the spesific button is on the second column. I tried to change things with the margins and few others, but without success.

currently all the configurations are default.

This is my button:

This is my button:

This is how I would like it to behave:

This is the desired behavior:

any help would be highly appreciated. many thanks!

Upvotes: 0

Views: 170

Answers (1)

ilia_b
ilia_b

Reputation: 139

i would need some code to be sure, but it looks like you need to call tabFolder.layout(true) after changing the button text to compute the new position of your button

Upvotes: 1

Related Questions