Dynamically add Textbox to Window when checkbox is checked
I'm just figuring out my way around SWT. I have a little problem that i cant seem to solve. I have a check-box in my window. When the check-box is checked, i would like add a multi-line, read-only, text box below it, lets say 200x200. I want the height of the window to increase to accommodate this text-box. When the check-box is unchecked I'd like the opposite to happen.
Could you help me with this? I can't find an example but maybe I'm not using the right keywords. Cheers.
--EDIT
the.duckman'ss answer was very helpful. I've managed to get it working to some extent. I'm adding a multi-line textbox 480px high. How do I automatically resize the window to accommodate the text box? When the user checks th开发者_运维知识库e checkbox, the textbox shows up but the height of the window doesn't increase to accommodate the textbox. My code is a little long so I've put it in PasteBin — http://pastebin.com/01RxKeEr
Thanks.
I recommend looking at the SWT Snippets to every beginner - that's probably the best place to go to with SWT questions.
This snippet does exactly what you want.
Edit
Ooops, I ignored the second half of your question, sorry. Simply add this line to your listener:
shell.setSize(shell.computeSize(SWT.DEFAULT, SWT.DEFAULT));
精彩评论