Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

alert problem!

 
Mateen Dar
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi i am having problem with the following code ..

alert=new Alert("Conenction Error","Invalid Info",null,AlertType.ERROR);
alert.setTimeout(Alert.FOREVER);
alert.setTimeout(10000);
display.setCurrent(alert, mainForm);
display.setCurrent(mainForm);


when ever the alert is to be shown, it shows it for a fravtion of second and the mainfrom is displayed. what i want to do that if an error occurs the laert should be displayed , and after the user presses the ok button the mainform should be shown again .thanks.
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

alert=new Alert("Conenction Error","Invalid Info",null,AlertType.ERROR);
alert.setTimeout(Alert.FOREVER);
alert.setTimeout(10000);
display.setCurrent(alert, mainForm);
display.setCurrent(mainForm);


You only need one of these
alert.setTimeout(Alert.FOREVER);
alert.setTimeout(10000);

because only the last one is used.

and you only need
display.setCurrent(alert, mainForm);

because setCurrent will occur immediately then it will run the next line immediately and never keep your Alert up. Don't think of it as blocking the thread until that Alert completes.

Mark

Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic