Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Jordanos
Posts: 19
Registered: ‎08-30-2009
My Device: Not Specified
Accepted Solution

Dialog clears portion of screen upon close

[ Edited ]

Hi all,

 

I'm having an issue using the Curve 8830 simulator and  JDE 4.2.1 when closing dialog boxes. When I close a dialog message in my app, upon closing, the dialog box clears a rectangle of the screen that is in proportion to the size of the dialog box. That is, if I've drawn bitmaps in the background, they are erased (and I believe fields are left unaffected). This seems to only happen using the 8830 and doesn't happen when using, say, the 8520 simulator (that has a newer OS). Are there any potential solutions to this issue? Thanks in advance!

 

I'm basically calling the dialog box using:

 

//for example...

 

int response = Dialog.ask(Dialog.D_YES_NO, "Do you think the screen will clear the background", Dialog.YES);

if(response == Dialog.NO){
...                         
}else{

...                       

}

 

 

In reading a similar thread, it's suggest that this may help, "If you are not using pushModal() with the GLOBAL flag set, then please try this first.", but there was no clear example of how to exactly implement this...

 

 

Thanks again

Message Edited by Jordanos on 09-27-2009 02:07 PM
Message Edited by Jordanos on 09-27-2009 02:08 PM
Message Edited by Jordanos on 09-27-2009 02:17 PM
Developer
RexDoug
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: Dialog clears portion of screen upon close

You should detect the onFocus() or onExposed() event in your screen and call invalidate().

 

This will precipitate a repaint.

 

Developer
Jordanos
Posts: 19
Registered: ‎08-30-2009
My Device: Not Specified

Re: Dialog clears portion of screen upon close

Hi RexDoug!

 

Thanks for the reply. This was actually the first thing I tried to do to fix it and it didn't seem to work. I'm already calling the Dialog to appear using an "onExposed" method, but invalidate still clears the background without repainting the bitmaps (since they aren't called to be painted within the main paint thread I believe) .

 

Thanks!

 

- Jordan

Developer
Jordanos
Posts: 19
Registered: ‎08-30-2009
My Device: Not Specified

Re: Dialog clears portion of screen upon close

I've just decided to fix the problem by calling invalidate and then having all the bitmaps redrawn under the paint method. I was trying to save resources, but this is the only solution that seems to work at this point...

 

- Jordan

Developer
RexDoug
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: Dialog clears portion of screen upon close

Not sure I understand the staement "call Dialog from the onExposed() method".

 

Can you elaborate?  I've nver seen a situation where you issue could not be resolved with a deft call to invalidate() (in the right place).

 

 

 

 

Developer
Jordanos
Posts: 19
Registered: ‎08-30-2009
My Device: Not Specified

Re: Dialog clears portion of screen upon close

Oh sorry for the confusion - I just meant that the reason I'm displaying a dialog box is if the App is "exposed". So "onExposed" display message "..." etc...

 

Thanks for the advice though, calling invalidate and then repainting the bitmaps works fine.

 

- Jordan