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: 412
Registered: ‎04-04-2012
My Device: BlackBerry Z30/Z10/Z10LE/Q10/PlayBook
Accepted Solution

SettingsActionItem / NavigationPane in TabbedPane initialization

  I am having a problem getting SettingsActionItem to function properly with dynamic creation of NavigationPanes that are in a TabbedPane.

  The problem is that when I start the app, I create the first tab NavigationPane at the onCreationCompleted signal. If I then try to access the SettingsActionItem, I cannot push anymore pages on the settings page.

  If I select another tab, I can push more pages on the settings page even when I go back to the first tab that wouldn't work the first time. It has to be something with the initialization of the first NavigationPane.

 

import bb.cascades 1.0

// Include asset folders
import "folder1"
import "folder2"
import "folder3"

TabbedPane {
    id: tabbedPane
    showTabsOnActionBar: false

    // Set to first tab id

    property NavigationPane currentNavigationPane: oneNavPaneObject

    property OneNavPane oneNavPaneObject
    property TwoNavPane twoNavPaneObject
    property ThreeNavPane threeNavPaneObject

    // Attached Objects

    attachedObjects: [
        ComponentDefinition {
            id: settingsListPage
            source: "SettingsListPage.qml"
        },
        Sheet{
            id: infoSheet
            InfoPage {
                id: infoPage
                onDone: {
                    infoSheet.close();
                }
            }
        },
        ComponentDefinition {
            id: oneNavPaneDefinition
            OneNavPane { }
        },
        ComponentDefinition {
            id: twoNavPaneDefinition
            TwoNavPane { }
        },
        ComponentDefinition {
            id: threeNavPaneDefinition
            ThreeNavPane { }
        }      
    ]
      
    // Application Menu

    Menu.definition: MenuDefinition {
        id: menu
        actions: [
            ActionItem {
                title: "Info"
                imageSource: "icons/info.png"
                onTriggered: {
                    // For InfoPage, we will use Sheet
                    infoSheet.open();
                }
            }
        ]
        settingsAction: SettingsActionItem {
            imageSource: "icons/settings.png"
            onTriggered: {
                // For Settings, we will use NavigationPane
                var settingsListPageObj = settingsListPage.createObject();
                Application.menuEnabled = false;
                currentNavigationPane.push(settingsListPageObj);
            }
        }
    } 
    
    // Tabs

    Tab {
        id: oneTab
        title: qsTr("One")
        imageSource: "icons/one.png"
        onTriggered: {
            oneNavPaneObject = oneNavPaneDefinition.createObject()
            currentNavigationPane = oneNavPaneObject
            oneTab.content = oneNavPaneObject
        }
    }
    Tab {
        id: twoTab
        title: qsTr("Two")
        imageSource: "icons/two.png"
        onTriggered: {
            twoNavPaneObject = twoNavPaneDefinition.createObject()
            currentNavigationPane = twoNavPaneObject
            twoTab.content = twoNavPaneObject
        }
    }
    Tab {
        id: threeTab
        title: qsTr("Three")
        imageSource: "icons/three.png"
        onTriggered: {
            threeNavPaneObject = threeNavPaneDefinition.createObject()
            currentNavigationPane = threeNavPaneObject
            threeTab.content = threeNavPaneObject
        }
    }
    onCreationCompleted: {
        oneNavPaneObject = oneNavPaneDefinition.createObject()
        currentNavigationPane = oneNavPaneObject
        oneTab.content = oneNavPaneObject
    }
}

 

Highlighted
Developer
Posts: 412
Registered: ‎04-04-2012
My Device: BlackBerry Z30/Z10/Z10LE/Q10/PlayBook

Re: SettingsActionItem / NavigationPane in TabbedPane initialization

Solved: Solution was to set the active tab.

 

    onCreationCompleted: {
        oneNavPaneObject = oneNavPaneDefinition.createObject()
        currentNavigationPane = oneNavPaneObject
        oneTab.content = oneNavPaneObject
        tabbedPane.activeTab = oneTab
    }