This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes SWT: Is dynamic resize of Combo possible? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "SWT: Is dynamic resize of Combo possible?" Watch "SWT: Is dynamic resize of Combo possible?" New topic
Author

SWT: Is dynamic resize of Combo possible?

Bhavani Kumar
Greenhorn

Joined: Feb 22, 2005
Posts: 15
Hi all,
My scenario is : I have 2 combos in a Composite. Depending on the value selected in the first Combo, the second Combo is populated. Now the values in the second combo are of variable length, so i need to resize the combo depending on the length of the text. Is it possible, since we place the combos on the composite in the beginning itself ?

Code:

msgFmtCmb = new Combo(paramComp, SWT.READ_ONLY);
gridData = new GridData();
gridData.horizontalSpan = 2;
msgFmtCmb.setLayoutData(gridData);
msgFmtCmb.addModifyListener(this);

msgTypeCmb = new Combo(paramComp, SWT.READ_ONLY);
final GridData grdDataMsgType = new GridData();
grdDataMsgType.horizontalSpan = 2;
msgTypeCmb.setLayoutData(grdDataMsgType);
msgTypeCmb.addModifyListener(this);

In the modifyText method, i am removing all values from the second combo and adding new values.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: SWT: Is dynamic resize of Combo possible?
 
Similar Threads
SWT Text in a single row
Dialog resize in SWT
SWT resize/modal question
ActionListener to Jface Dialogue
swt buttons wont right-align