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

Reply
Developer
Tobster_
Posts: 270
Registered: ‎07-20-2012
My Device: Blackberry Z10 (White), BlackBerry Dev Alpha C

Re: Cascades Radio Button, Title Bar, Drop Down Help

[ Edited ]

EDIT:

 

I have been sat trying to figure out the best and simplest way to achieve a dropdown application menu and it seems I have managed to create one, 

 

Menu.definition: MenuDefinition {
        settingsAction: SettingsActionItem {
            attachedObjects: [
                Sheet {
                    id: settingsSheet
                    Settings {
                    }
                }
            ]
            onTriggered: {
                settingsSheet.open();
            }
        }
        helpAction: HelpActionItem {
            attachedObjects: [
                Sheet {
                    id: helpSheet
                    Help {
                    }
                }
            ]
            onTriggered: {
                helpSheet.open()
            }
        }
        actions: [
            ActionItem {
                title: "About"
                imageSource: "asset:///IMG/ic_info.png"
                attachedObjects: [
                    Sheet {
                        id: aboutSheet
                        About {
                        }
                    }
                ]
                onTriggered: {
                    aboutSheet.open()
                }
            }
        ]
    }

 Now, it's just trying to see why the share function doesn't operate at all on a Z10 at all using either InvokeAction and getting it to invoke the share card to share the current URL and text with it or by using the C++ code that has been provided already - no idea why neither seems to share the current URL (it will invoke the share card, select the target but then does nothing afterwards and with the C++ signals clicking the button in the actionBar does nothing.) So, any help with getting the share function to operate correctly (share the current URL of the webview combined with text such as "Look at what I found on ..., view it here" 

 

Thanks :smileyvery-happy:

Retired
robbieDubya
Posts: 418
Registered: ‎07-18-2012
My Device: Q10

Re: Cascades Radio Button, Title Bar, Drop Down Help

Hi,

 

Relating to the radio group changing content:

 

The code shows you're already reacting to the signal emitted when the selection changes.

 

You just need to alter that code so that it does more than r2.play.

 

Thanks.

--
Rob is no longer associated with BlackBerry.
Developer
Tobster_
Posts: 270
Registered: ‎07-20-2012
My Device: Blackberry Z10 (White), BlackBerry Dev Alpha C

Re: Cascades Radio Button, Title Bar, Drop Down Help

Thanks :smileyhappy: Instead of having this:

 

onSelectedOptionChanged: {
                                rt2.play()
                                toggleExpanded.checked = false
                            }

 Is there a way to just push each QML page when each different one is selected? For example, when this is selected

 

Option {
                                id: ca
                                text: "Canada"
                            }

 It pushs the Canada.qml page and when a different country is selected say US, it pushes US.qml; is that possible?

Retired
robbieDubya
Posts: 418
Registered: ‎07-18-2012
My Device: Q10

Re: Cascades Radio Button, Title Bar, Drop Down Help

Yes, it's possible.

 

One thing that may appear jolting to a user is that the title bar is part of the tab which is about to vanish...

 

Here's a very simplified example.

 

I'm using a Button - as it's fewer lines of code.

I'm using inline content - again - as it's fewer lines of code.

 

activeTab allows you to set the active tab on a pane...

 

Hope this helps!

 

import bb.cascades 1.0

TabbedPane {
    id: pane
    tabs: [
        Tab {
            id: tabA
            title: "A"
            content: Page {
                Button {
                    text: "Click Me"
                    onClicked: {
                        pane.activeTab = tabB;
                    }
                }
            }
        },
        Tab {
            id: tabB
            title: "B"
            content: Page {
                Label {
                    text: "Very boring page"
                }
            }
        }
    ]
}

 

--
Rob is no longer associated with BlackBerry.
Developer
Tobster_
Posts: 270
Registered: ‎07-20-2012
My Device: Blackberry Z10 (White), BlackBerry Dev Alpha C

Re: Cascades Radio Button, Title Bar, Drop Down Help

Would that work with a radio group though? As what I am trying to do is push each page and as there's more than one page using 

 

onClicked: {
                        pane.activeTab = tabB;
                    }

 

wouldn't work, to push each page - it would only be able to push one page with a tab id of tabB. Is there not a simple way to use the radio buttons, or even a simple dropdown, just so that when one option is selected that page loads?

Retired
robbieDubya
Posts: 418
Registered: ‎07-18-2012
My Device: Q10

Re: Cascades Radio Button, Title Bar, Drop Down Help

Radio groups have more signals than buttons.

 

Have a look at the signals emited by the RadioGroup class. There are several ways you can catch what happened. Here's one:

 

import bb.cascades 1.0

TabbedPane {
    id: pane
    tabs: [
        Tab {
            id: tabA
            title: "A"
            content: Page {
                RadioGroup {
                    id: radio
                    onSelectedValueChanged: {
                        if (selectedValue == 0) {
                            // do nothing -that is THIS tab.
                        } else if (selectedValue == 1) {
                            pane.activeTab = tabB;
                            radio.selectedIndex = 0; // reverting to 0 so radio looks correct if shown again.
                        } else {
                            console.log("Not handling this change to " + selectedValue);
                        }
                    }
                    options: [
                        Option {
                            id: a
                            value: 0
                            text: "A"
                        },
                        Option {
                            id: b
                            value: 1
                            text: "B"
                        },
                        Option {
                            id: c
                            value: 2
                            text: "C"
                        }
                    ]
                }
            }
        },
        Tab {
            id: tabB
            title: "B"
            content: Page {
                Label {
                    text: "Very boring page"
                }
            }
        }
    ]
}

 

 

 

--
Rob is no longer associated with BlackBerry.
Developer
Tobster_
Posts: 270
Registered: ‎07-20-2012
My Device: Blackberry Z10 (White), BlackBerry Dev Alpha C

Re: Cascades Radio Button, Title Bar, Drop Down Help

That would work with if I was using tabs in the same qml document. What I would like to do is load different qml documents instead of different tabs, can I do that or can I only load tabs? Thanks

Retired
robbieDubya
Posts: 418
Registered: ‎07-18-2012
My Device: Q10

Re: Cascades Radio Button, Title Bar, Drop Down Help

Yes. You can use the ComponentDefinition class to load and instantiate arbitrary QML... 

 

Classes like Container have an add method for adding items to them...

--
Rob is no longer associated with BlackBerry.
Developer
Tobster_
Posts: 270
Registered: ‎07-20-2012
My Device: Blackberry Z10 (White), BlackBerry Dev Alpha C

Re: Cascades Radio Button, Title Bar, Drop Down Help

That's good then, can I use it on the radio button dropdown?

 

If there isn't a way to load an individual qml document when a different radio button is selected, then could you think of another way for me to implement a country selector? The country selector is so that a different page is shown for the different country; for example, when Canada is selected it will show the Canada.qml page and will do the same when other countries are selected. Is there another way in Cascades to do that or would the title bar dropdown be the best