0

How do you set the action menu button as selected when it's already on its view? I ave this one view with action menu tabs, then when you tapped one then it'll redirect the user to that view, and I want the button to be displayed as pressed. Where do I set the selected state of the button?

Here's my qml:

import bb.cascades 1.0

Page {

    Container {
        background: Color.create("#f9f7f2");
        layout: StackLayout {}

        // Container for holding the title
        Container {
            horizontalAlignment: HorizontalAlignment.Center
            layout: DockLayout {}

            ImageView {
                horizontalAlignment: HorizontalAlignment.Fill
                verticalAlignment: VerticalAlignment.Fill
                imageSource: "asset:///images/navigation_bar.png"
            }

            Container {
                horizontalAlignment: HorizontalAlignment.Right
                rightPadding: 30
                topPadding: 40
                layout: DockLayout {}

                ImageButton {
                    id: btnsettings
                    verticalAlignment: VerticalAlignment.Center
                    defaultImageSource: "asset:///images/navbar_icon_settings.png"

                    onClicked: {
                        // show settings page when the button is clicked
                        cppObj.onSettingsClicked();
                    }
                }
            }
        }
        Container {
            topPadding: 20
            leftPadding: 20
            rightPadding: 20
            bottomPadding: 20
            background: Color.create("#F4E9E1");
            horizontalAlignment: HorizontalAlignment.Fill
            layout: StackLayout {}

            Label {
                verticalAlignment: VerticalAlignment.Center
                horizontalAlignment: HorizontalAlignment.Left
                text: cppObj.name

                textStyle {
                    //  fontFamily: FontStyle.Default.Myriad
                    // fontSize: 36
                    color: Color.create("#60323C")
                }
            }
        }

        Container {
            verticalAlignment: VerticalAlignment.Center
            horizontalAlignment: HorizontalAlignment.Center
            layout: DockLayout {}
            Divider {}
            ScrollView {
                scrollViewProperties {
                    scrollMode: ScrollMode.Vertical
                }
            /* ImageView {
             id: listviewbackground
             verticalAlignment: VerticalAlignment.Center
             horizontalAlignment: HorizontalAlignment.Center
             scalingMethod: ScalingMethod.Fill
             imageSource: "asset:///images/list_view_cell.png"
             }*/

                ListView {
                    id: lvprojects
                    dataModel: cppObj.model()

                    listItemComponents: [
                        ListItemComponent {
                            type: "item"

                            Container {
                                horizontalAlignment: HorizontalAlignment.Center
                                layout: DockLayout {}
                                touchPropagationMode: TouchPropagationMode.Full;

                                StandardListItem {
                                    title:ListItemData.desc
                                }
                            }
                        }
                    ]

                    onTriggered: {
                        var selectedItem = dataModel.data(indexPath);

                        onClicked: {
                            // show issue's comment page when the button is clicked
                            cppObj.onIssueClicked(selectedItem.name);
                        }
                    }
                }
            }
        }
     }

    actions: [
        ActionItem {
            title: qsTr ("Add Issue")
            imageSource: "asset:///images/actionbar_icon_add.png"
            ActionBar.placement: ActionBarPlacement.OnBar

            onTriggered: {
                cppObj.onAddIssuesClicked();
            }
        },

        ActionItem {
            title: qsTr ("Issues")
            imageSource: "asset:///images/actionbar_icon_issues.png"
            ActionBar.placement: ActionBarPlacement.OnBar

            onTriggered: {
                cppObj.onIssuesClicked();
            }
        },

        ActionItem {
            title: qsTr ("Members")
            imageSource: "asset:///images/actionbar_icon_members.png"
            ActionBar.placement: ActionBarPlacement.OnBar

            onTriggered: {
                cppObj.onMembersClicked();
            }
        }
    ]
}
kev
  • 155
  • 1
  • 11

1 Answers1

0

I guess what you're trying to achieve is to mark a tab as active: void TabbedPane::setActiveTab (bb::cascades::Tab *activeTab)

Marc Plano-Lesay
  • 6,808
  • 10
  • 44
  • 75
  • I'm currently using a navigation pane and action menu, how do i implement that? – kev Jul 17 '13 at 07:08
  • Why aren't you using a TabbedPane? That's why it's for. – Marc Plano-Lesay Jul 17 '13 at 08:17
  • I've added the qml. How to change this to tabbed pane? – kev Jul 17 '13 at 10:32
  • I guess your ``onIssuesClicked()``, ``onAddIssuesClicked()`` and ``onMembersClicked()`` switch the visibility of your three top-level containers. You should replace your ``Page`` by a ``TabbedPane``, and replace your three top-level containers by three `Tab`s containing `Page`s. Transition will be automatic. – Marc Plano-Lesay Jul 17 '13 at 18:26
  • What Kernald said is right. You're using action items for something they're not meant to. Look at the TabbedPane documentation on its usage. It's exactly what you need for this task. – Ergin Babani Jul 23 '13 at 04:05