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

Native Development

Reply
Developer
gpatton
Posts: 193
Registered: ‎12-29-2010
My Device: Bold 9900
My Carrier: Rogers
Accepted Solution

Does sheet.close() destroy the sheet as well?

Question is in the subject. When I open a new sheet, let's say with id: sheet,  and create a button in that sheet.

 

Does calling the sheet.close() method from the button, destroy the sheet as well?

 

Don't want any memory issues etc.

 

Thanks.

Please use plain text.
Developer
Zmey
Posts: 1,512
Registered: ‎12-18-2012
My Device: PlayBook, Z10, DAC

Re: Does sheet.close() destroy the sheet as well?

The sheet is not destroyed automatically when closed. It's possible to show it again.

It will be destroyed only when it's parent is destroyed. Or you can connect to closed() signal and destroy it there if it's no longer needed.

 


Andrey Fidrya, @zmeyc on twitter
Please use plain text.
Developer
gpatton
Posts: 193
Registered: ‎12-29-2010
My Device: Bold 9900
My Carrier: Rogers

Re: Does sheet.close() destroy the sheet as well?

Ah I see. Thanks. In your (or anyone else's) opinion, is it important to destroy it? Or simply closing it fine?

I'm using sheets for Application menus - the ones you get from swiping from the top. I'm guessing it'd be fine to just close them because they might be needed once in a while. Correct me if I'm wrong.

Thanks.
Please use plain text.
Developer
Zmey
Posts: 1,512
Registered: ‎12-18-2012
My Device: PlayBook, Z10, DAC

Re: Does sheet.close() destroy the sheet as well?

[ Edited ]

Generally it's fine to reuse them (just make sure you aren't creating multiple instances).

 

BUT in Gold SDK there's a bug targetting specifically the Application menu. The app will crash when you show the Sheet for second time from Application menu's ActionItem handler. This thread has the workaround:

http://supportforums.blackberry.com/t5/Cascades-Development/Application-menu-unavailable-twice-after...


Andrey Fidrya, @zmeyc on twitter
Please use plain text.
Developer
gpatton
Posts: 193
Registered: ‎12-29-2010
My Device: Bold 9900
My Carrier: Rogers

Re: Does sheet.close() destroy the sheet as well?

Thanks man. Turns out I was following the guidelines in that thread you mentioned all along. createObject and then destroy etc.

Please use plain text.