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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


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

Sheet as a Component Defintion

Hi,

I was creating application menus in my application, below the root TabbedPane. Followed the docs online.

I realized that I have to create a Sheet, and can't create a Page. Which is fine. I was hoping for a back-button-esque page.

 

For NavPanes, I know we can create Pages as a Component Definition, so they can be loaded only when needed. I can't do the same for Sheets. Is this is a known limitation?

 

I've done the following, but it doesn't work:

mainTabPane.qml



TabbedPane {
    id: mainTabPage

    Menu.definition: MenuDefinition {
        actions: [
            ActionItem {
                title: "About"
                onTriggered: {
                    aboutSheetDefinition.open();
                }
            }
        ]
    } // end of Menu defintion

    attachedObjects: [
        ComponentDefinition {
            id: aboutSheetDefinition
            source: "about.qml"
        }
    ]
    Tab {
        ...
    }
}

 And then in the about.qml

import bb.cascades 1.0

Sheet {
    id: aboutSheet
    content: Page {
        id: aboutPage
        Container {
            Label {
                text: "This is the ABOUT page"
            }
        }
    }
}

 

 

However, if I do the following, it works. But I want it to work the way I've shown above----^^^ (mainTabPane.qml)

 

TabbedPane {
    id: mainTabPage

    // Application Menu
    Menu.definition: MenuDefinition {
        actions: [
            ActionItem {
                title: "About"
                onTriggered: {
                    aboutSheet.open();
                }
            }
        ]
    } // end of Menu defintion
    
    attachedObjects: [        
        Sheet {
            id: aboutSheet
            content: Page {
                id: aboutPage
                Container {
                    Label {
                        text: "This is the ABOUT page"
                    }
                }
            }
        }
    ]
    Tab {
        ...
    }
}

 

Highlighted
Developer
Posts: 193
Registered: ‎12-29-2010
My Device: Bold 9900
My Carrier: Rogers

Re: Sheet as a Component Defintion

[ Edited ]

Never mind. Found my solution.

 

In the ActionItem's onTriggered, have to do the following, i.e. create the aboutSheet variable object, and THEN open it.

 

onTriggered: {
                    var aboutSheet = aboutSheetDefinition.createObject();
                    aboutSheet.open();
                }

 

The attached object, stays the same.

 

attachedObjects: [
        ComponentDefinition {
            id: aboutSheetDefinition
            source: "about.qml"
        }
    ]

 

Visitor
Posts: 1
Registered: ‎05-03-2013
My Device: Blackberry Z10 STL100-3
My Carrier: AT&T

Re: Sheet as a Component Defintion

I'm actually having this same problem. Only, with the same setup, it is not working for me.

 

Do you have any extra includes for ComponentDefinition use or the createObject() member?