I need help to understand how addDrawHandler works.
In my application, I have 2 vertical layouts (called startLayout and mainLayout). Initially, startLayout is displayed and mainLayout is hidden. startLayout has a button (called startButton). When the start button is clicked, I call startLayout.hide(), SC.showPrompt("Loading data...") to display a prompt, do some processing and then show the mainLayout.
I have registered addDrawHandler for the mainLayout like this:
After the data is fetched, I call mainLayout.show(). At this point, I expect the prompt to be cleared when onDraw() is called. But what I found is that this works intermittently. The mainLayout is displayed, but the prompt isn't always cleared. However, if I manually call SC.clearPrompt() right before calling mainLayout.show(), the prompt is cleared consistently.
One other thing I noticed is that if the processing is quick, the prompt isn't cleared. But when the processing takes a while, the prompt is cleared.
Please help me understand whether I'm missing something or DrawHandler isn't working properly.
Thanks.
In my application, I have 2 vertical layouts (called startLayout and mainLayout). Initially, startLayout is displayed and mainLayout is hidden. startLayout has a button (called startButton). When the start button is clicked, I call startLayout.hide(), SC.showPrompt("Loading data...") to display a prompt, do some processing and then show the mainLayout.
I have registered addDrawHandler for the mainLayout like this:
Code:
mainLayout.addDrawHandler(new DrawHandler() { public void onDraw(DrawEvent event) { SC.clearPrompt(); } });
One other thing I noticed is that if the processing is quick, the prompt isn't cleared. But when the processing takes a while, the prompt is cleared.
Please help me understand whether I'm missing something or DrawHandler isn't working properly.
Thanks.
Comment