06-22-2012 01:03 PM
I have several discrete screen I'd like to show in my app. To the best of my knowledge, different screens are set via the
Application::setScene(mainPage);
call. However, I've had lots of troubles at different parts using this method.
For example
Application::setScene(mainPage) -> "Open Gallery" button click invokes Application::setScene(galleryView) -> "Close Gallery" button click invokes Application::setScene(mainPage)
Not only does this scare me about the possibility of memory leaks, but this method invokes a crash saying I haven't deallocated the ListView contained in galleryView correctly.
What am I missing here? It looks like NavigationPane solves part of this problem, but I don't want the Navigation UI that comes along with it. I've also heard something about a concept of Sheets in the upcoming build? Should I be waiting on that?
Thanks,
-dp
06-22-2012 04:28 PM
This is related to http://supportforums.blackberry.com/t5/Cascades-De
Two choices immediately come to mind:
1. A NavigationPane with a standard background + current page. Pop current page, push new page.
2. A Pane. setContent to change the contents. Bear in mind that the pane will own the content. For small number of screens you could just keep a list of them and set the appropriate one. For large number, you might want to do some double-buffering or have a limited cache of pre-built pages.
If there are other approaches I'd love to hear them so I can add them to my arsenal.
Stuart
06-23-2012 07:42 AM - edited 06-23-2012 07:43 AM
How this ? :
-------------------------
Page {
content: Container {
SegmentedControl {
Option { id: option1; text: "Container1"; value: "option1"; selected: true }
Option { id: option2; text: "Container2"; value: "option2" }
onSelectedIndexChanged: {
if (selectedIndex == 0) {
cnt2.visible = false;
cnt1.visible = true;
}
else if (selectedIndex == 1) {
cnt1.visible = false;
cnt2.visible = true;
}
}
} // SegmentedControl
Container {
id: cnt1
}
Container {
id: cnt2
}
} // Container
} // Page
---------------
Yeah, visible() is your friend. ![]()