12-14-2012 05:01 PM - edited 12-14-2012 05:04 PM
I am trying to use a Sheet in the pull down menu for my application. By this I mean the menu items you can use when you pull down from the top - typically you will find Information and Settings in there.
But when I add a sheet to this menu, it works once, then the next time I pull down the menu button appears and does nothing, then after that, pulling down from the top does nothing at all.
To recreate this, all you need to do is create a standard Cascades project with a Navigation Pane. Then update the QML for the initial screen (main.qml) to that below. The idea is that the pull down menu will display a 'Help page' with information on the application. All the user can do on that page is close it. So the only changes are the addition of the MenuItem and the attached 'sheet' object.
I can't see what I have done wrong, but then I am pretty new to all this stuff. So any help would be appreciated.
Thanks.
// Navigation pane project template
import bb.cascades 1.0
NavigationPane {
id: navigationPane
//! Add pull down menu item to push info screen
Menu.definition: MenuDefinition {
helpAction: HelpActionItem {
onTriggered : {
console.log("NavigationPane - info.open()");
infoSheet.open();
}
}
}
Page {
// page with a picture thumbnail
Container {
background: Color.Black
layout: DockLayout {
}
Button {
horizontalAlignment: HorizontalAlignment.Center
verticalAlignment: VerticalAlignment.Center
text: qsTr("Show detail")
imageSource: "asset:///images/picture1thumb.png"
onClicked: {
// show detail page when the button is clicked
var page = getSecondPage();
console.debug("pushing detail " + page)
navigationPane.push(page);
}
property Page secondPage
function getSecondPage() {
if (! secondPage) {
secondPage = secondPageDefinition.createObject();
}
return secondPage;
}
attachedObjects: [
ComponentDefinition {
id: secondPageDefinition
source: "DetailsPage.qml"
}
]
}
}
}
//! Add Info sheet as attached item
attachedObjects: [
Sheet {
id: infoSheet
Page {
titleBar: TitleBar {
title: "Info"
visibility: ChromeVisibility.Visible
dismissAction: ActionItem {
title: "Back"
onTriggered: {
// Hide the Sheet.
console.log("infoSheet - infoSheet.close()");
infoSheet.close();
}
}
}
Container {
layout: DockLayout {
}
Container {
TextArea {
text: "Information on Application"
}
}// Text Area Container
}// Edit pane Container
}// Page
}// Sheet
]
onCreationCompleted: {
// this slot is called when declarative scene is created
// write post creation initialization here
console.log("NavigationPane - onCreationCompleted()");
// enable layout to adapt to the device rotation
// don't forget to enable screen rotation in bar-bescriptor.xml (Application->Orientation->Auto-orient)
OrientationSupport.supportedDisplayOrientation = SupportedDisplayOrientation.All;
}
}
Solved! Go to Solution.
12-15-2012 11:40 AM
I think this is a known issue - I have the same problem
12-15-2012 12:10 PM
12-15-2012 06:22 PM
I might have found a workaround for this issue. Try putting your Sheet in a ComponentDefinition, and then dynamically creating the sheet whenever you want to view it. Something like:
/* define the sheet */
attachedObjects: [
ComponentDefinition {
id: mySheetDefinition
Sheet {
// your content here
}
}
]
/* display the sheet */
var mySheet = mySheetDefinition.createObject();
mySheet.open();
I'm still testing some other issues, but it appears to work OK, and my application menu remains functional this way
12-16-2012 11:03 AM
Thanks, I iwll check out your workaround myself, though I have just changed all my sheets to Pages!!!!
12-16-2012 11:35 AM
12-18-2012 11:05 AM
Can confirm that the workaround does indeed work for me. Thanks. But I will be sticking with Pages.
Peter,
I appreciate your comment regarding the back button, but is it not a waste of real estate at times? You can stick the 'Back' button in the Sheet titleBar and effectively gain another row.....
12-18-2012 11:20 AM
12-18-2012 12:04 PM
"... so if you haven't read that you should," Good point!
"your gut feeling about these things is probably at least as good as mine..." I'd rate yours above mine, you have played with this much more than me!
Thanks to all.
12-31-2012 03:28 AM
Thanks ! The solution works for me... Still needs testing out in all cases though.