| Reply | « Previous Thread | Next Thread » |
|
HI!
How can i initialize the Alert(as forever) in a Form extended class as when the class get start? when i put alert in init function it doesnt show it why ? while on kepressing and comand listener its working. thanks farhan |
|
I don't understand what you are trying to do.
Maybe post some relevant code. shmoove |
|
i am trying this but its not showing alert ....
this class is extended from FORM /**Component initialization*/ private void jbInit() throws Exception { addCommand(new Command("Back", Command.BACK, 1)); try{ i= i.createImage("/born4pure/images/solder.png"); imageItem1.setImage(i); } catch (java.io.IOException e) { System.out.println(e.getMessage()); System.out.println("image not found"); } showMessage(); } //this method is for alert public void showMessage() { Alert a= new Alert("ERROR"); a.setImage(i); a.setTimeout(Alert.FOREVER); Display.getDisplay(Born4Pure.instance).setCurrent(a); } i am putting this inside the init function because , when user will come at this java file then he must see the Forever Alert message untill he wont dismiss by him self. So because of that reason i am trying to put alert in JBINIT but its not working , while on comand lsitener it works..... |
|
I don't know what is calling jbInit() so I can't be sure why the alert doesn't display.
But, I don't know if you are aware of this, but Display.setCurrent() has another variation that might be of use to you: Code:
public void setCurrent(Alert alert, Displayable nextDisplayable) You could use this to display the alert and then the form (as your nextDisplayable), instead of displaying the alert from the form's startup code. |
|
My guess though as to why your code doesn't work is that you are asking to display the alert before asking to display the form.
If jbInit() is called from the Forms constructor (as the name suggests) then the call to setCurrent() for the alert is coming before any calls to setCurrent() for the form. |
|
Example (assuming the form's class is called MyForm):
Code:
// there is no way to call setCurrent any faster for the form!! Display.getDisplay(Born4Pure.instance).setCurrent(new MyForm()); |
| Reply | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|