Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » control widget on main form from composite?
control widget on main form from composite? [message #465966] Tue, 27 December 2005 11:37 Go to next message
mp is currently offline mpFriend
Messages: 8
Registered: July 2009
Junior Member
For one of the apps I'm working on I use multiple composites in a form. I
ran into a problem for which I do not see a quick solution... A simplefied
case:

I use a composite with 2 textboxes (separate class) in a form. Normaly I
update eg text values from main form in composite but this time I'm
looking at doing something the other way around. The composite changing
something on main form....

Is it possible to set a button on the form to enabled (not part of
composite) as soon as both textboxes contain data. How can this be done?
Re: control widget on main form from composite? [message #465970 is a reply to message #465966] Tue, 27 December 2005 15:30 Go to previous message
Jeremy Dowdall is currently offline Jeremy DowdallFriend
Messages: 48
Registered: July 2009
Member
if I'm understanding this correctly, you could add a ModifyListener to
each textbox (textbox.addModifyListener(ModifyListener)) then do
something to check the status of the boxes and update the button on the
main form if necessary.

a simplified (and non-optimal) method:

textbox1.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
button.setEnabled( (textbox1.getText().length() > 0) &&
(textbox2.getText().length() > 0) );
}
});



mp wrote:
> For one of the apps I'm working on I use multiple composites in a form.
> I ran into a problem for which I do not see a quick solution... A
> simplefied case:
>
> I use a composite with 2 textboxes (separate class) in a form. Normaly I
> update eg text values from main form in composite but this time I'm
> looking at doing something the other way around. The composite changing
> something on main form....
>
> Is it possible to set a button on the form to enabled (not part of
> composite) as soon as both textboxes contain data. How can this be done?
>
Previous Topic:Composite on TabFolder transparency
Next Topic:customizing swt widget
Goto Forum:
  


Current Time: Wed Dec 04 15:53:51 GMT 2024

Powered by FUDForum. Page generated in 0.02981 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top