PDA

View Full Version : MessageBox prompt


yopiyop
04-30-2008, 08:18 AM
how to get user Input from a MessageBox prompt?


MessageBox.prompt("Titre", " valeur :", new Listener<ComponentEvent>(){
public void handleEvent(ComponentEvent ce) {
Info.display("MessageBox", /*box.getTextBox().getValue()*/"???" );
}
});
thx. David

gslender
04-30-2008, 09:11 AM
simple...

final MessageBox box = MessageBox.prompt("Titre", " valeur :", new Listener<ComponentEvent>(){
public void handleEvent(ComponentEvent ce) {
Info.display("MessageBox", box.getTextBox().getValue() );
}
});

yopiyop
04-30-2008, 09:32 AM
compiler tell me :
The local variable box may not have been initialized

gslender
04-30-2008, 04:56 PM
ok,

So try this...

public void handleEvent(ComponentEvent ce) {
MessageBox box = (MessageBox)ce.component;
....etc
}

yopiyop
05-02-2008, 03:02 AM
sorry, but Cannot cast from Component to MessageBox...

gslender
05-02-2008, 05:48 AM
yep - well I guess the only other option is to assign the MessageBox returned by MessageBox.prompt() to a global and check that when the event fires...

I'd agree that perhaps a better solution should be developed considering the only use case available... odd hey !! :-?