1. pttptppt's Avatar
    So I'm developing an app using Momentics for the first time. And I'm stuck. Here's what I need help with:
    • Combining both toggle buttons and text on the same line. So essentially, there'll be a toggle button with a description of what it does (similar to the bb10 settings)
    • Making toggle buttons (and sliders) perform actions (ex. turn on the flashlight)
    • Add a display for what song is playing and have music controls (I know it's possible)
    • Make a toggle button change from dark to light theme (like in the cb10 app)

    Can anyone give some coded examples? Thanks
    08-31-14 08:21 AM
  2. thurask's Avatar
    So I'm developing an app using Momentics for the first time. And I'm stuck. Here's what I need help with:
    • Combining both toggle buttons and text on the same line. So essentially, there'll be a toggle button with a description of what it does (similar to the bb10 settings)
    • Making toggle buttons (and sliders) perform actions (ex. turn on the flashlight)
    • Add a display for what song is playing and have music controls (I know it's possible)
    • Make a toggle button change from dark to light theme (like in the cb10 app)

    Can anyone give some coded examples? Thanks
    #1: Important part bolded:

    Code:
    ...
                Container {
                    layout: StackLayout {
                        orientation: LayoutOrientation.LeftToRight
                    }
                    horizontalAlignment: HorizontalAlignment.Center
                    Label {
                        text: qsTr("Deltas") + Retranslate.onLanguageChanged
                        verticalAlignment: VerticalAlignment.Center
                    }
                    ToggleButton {
                        id: deltasetting
                        onCheckedChanged: {
                            ...
                        }
                    }
                    Button {
                        id: repobutton
                        text: qsTr("Known Software") + Retranslate.onLanguageChanged
                        onClicked: {
                            ...
                        }
                    }   
                }
    ...
    Which looks like:


    Help needed with developing!!!-20140831153053.jpg

    As for #2, that's what goes inside the onCheckedChanged action of the ToggleButton.

    Posted via CB10
    08-31-14 08:32 AM
  3. pttptppt's Avatar
    #1: Important part bolded:

    Code:
    ...
                Container {
                    layout: StackLayout {
                        orientation: LayoutOrientation.LeftToRight
                    }
                    horizontalAlignment: HorizontalAlignment.Center
                    Label {
                        text: qsTr("Deltas") + Retranslate.onLanguageChanged
                        verticalAlignment: VerticalAlignment.Center
                    }
                    ToggleButton {
                        id: deltasetting
                        onCheckedChanged: {
                            ...
                        }
                    }
                    Button {
                        id: repobutton
                        text: qsTr("Known Software") + Retranslate.onLanguageChanged
                        onClicked: {
                            ...
                        }
                    }   
                }
    ...
    Which looks like:


    Click image for larger version. 

Name:	20140831153053.jpg 
Views:	482 
Size:	6.4 KB 
ID:	294790

    As for #2, that's what goes inside the onCheckedChanged action of the ToggleButton.

    Posted via CB10
    Can you give an example for #2 please
    thurask likes this.
    08-31-14 08:35 AM
  4. thurask's Avatar
    Can you give an example for #2 please
    Code:
    ...
    ToggleButton {
                        id: deltasetting
                        onCheckedChanged: {
                            if (deltasetting.checked == true) {
                                  doThings(); //Whichever function you want
                            }
                        }
                    }
    ...
    Posted via CB10
    08-31-14 08:40 AM
  5. pttptppt's Avatar
    Okay I have no idea what you did for #1. Here's my code:
    TabbedPane {
    showTabsOnActionBar: true
    Tab { //First tab
    // Localized text with the dynamic translation and locale updates support
    title: qsTr("Tab 1") + Retranslate.onLocaleOrLanguageChanged
    Page {
    Container {
    background: Color.create("#daec932a")
    opacity: 1.0
    visible: true

    TextArea {
    text: "Turn this on for Flashlight"

    }
    ToggleButton {
    horizontalAlignment: HorizontalAlignment.Right

    }
    }
    }
    } //End of first tab
    Tab { //Second tab
    title: qsTr("Tab 2") + Retranslate.onLocaleOrLanguageChanged
    Page {
    Container {
    Label {
    text: qsTr("Second tab") + Retranslate.onLocaleOrLanguageChanged
    }
    }
    }
    } //End of second tab
    }
    08-31-14 08:40 AM
  6. thurask's Avatar
    Add layout orientation properties. Like so:

    Okay I have no idea what you did for #1. Here's my code:
    TabbedPane {
    showTabsOnActionBar: true
    Tab { //First tab
    // Localized text with the dynamic translation and locale updates support
    title: qsTr("Tab 1") + Retranslate.onLocaleOrLanguageChanged
    Page {
    Container {
    layout: StackLayout {
    orientation: LayoutOrientation.LeftToRight
    }

    background: Color.create("#daec932a")
    opacity: 1.0
    visible: true

    TextArea {
    text: "Turn this on for Flashlight"

    }
    ToggleButton {
    horizontalAlignment: HorizontalAlignment.Right

    }
    }
    }
    } //End of first tab
    Tab { //Second tab
    title: qsTr("Tab 2") + Retranslate.onLocaleOrLanguageChanged
    Page {
    Container {
    Label {
    text: qsTr("Second tab") + Retranslate.onLocaleOrLanguageChanged
    }
    }
    }
    } //End of second tab
    }
    http://developer.blackberry.com/nati...ientation.html

    Posted via CB10
    08-31-14 08:43 AM
  7. pttptppt's Avatar
    Add layout orientation properties. Like so:



    LayoutOrientation - BlackBerry Native

    Posted via CB10
    Ok thanks for your help but I have a question and a problem. the problem is that the toggle bar has its own background compared to the text

    And the question is, how do you make it turn on the flashlight? Can you give an example where it does this?
    08-31-14 08:47 AM
  8. thurask's Avatar
    Ok thanks for your help but I have a question and a problem. the problem is that the toggle bar has its own background compared to the text

    And the question is, how do you make it turn on the flashlight? Can you give an example where it does this?
    Don't think toggle buttons can be colorized: http://developer.blackberry.com/nati...e_buttons.html

    And as for the flashlight, look through this sample: https://github.com/blackberry/Cascad...ter/SensorDemo



    Posted via CB10
    08-31-14 08:55 AM
  9. pttptppt's Avatar
    Don't think toggle buttons can be colorized: Toggle buttons - BlackBerry Native

    And as for the flashlight, look through this sample: https://github.com/blackberry/Cascad...ter/SensorDemo



    Posted via CB10
    Thanks for everything. Can you add me on bbm: 24C66EE2 in case I have some more questions?
    08-31-14 09:00 AM
  10. UnlimitedEra's Avatar
    Hi Thurask!
    Thanks for all your efforts trying to help us out.
    I've been following what you recently said to Patrick and it works fine but when you have 2 buttons in the same line, the buttons are not aligned in the center the right way.
    I would also like to know how can I add a text line alligned in the center of the tab neither on the top side nor the bottom side only in the middle.
    And how can we get the settings tab when sliding down from the top bezel ?
    08-31-14 12:25 PM
  11. thurask's Avatar
    Hi Thurask!
    Thanks for all your efforts trying to help us out.
    I've been following what you recently said to Patrick and it works fine but when you have 2 buttons in the same line, the buttons are not aligned in the center the right way.
    I would also like to know how can I add a text line alligned in the center of the tab neither on the top side nor the bottom side only in the middle.
    And how can we get the settings tab when sliding down from the top bezel ?
    Settings tab is an ApplicationMenu: http://developer.blackberry.com/nati...ion/menus.html

    Alignment is handled with HorizontalAlignment and VerticalAlignment: http://developer.blackberry.com/nati...alignment.html

    http://developer.blackberry.com/nati...alignment.html

    Posted via CB10
    UnlimitedEra likes this.
    08-31-14 12:29 PM
  12. RodgerLeblanc's Avatar
    Ok thanks for your help but I have a question and a problem. the problem is that the toggle bar has its own background compared to the text

    And the question is, how do you make it turn on the flashlight? Can you give an example where it does this?
    Use Label {} instead of TextArea {}

    Posted via CB10
    09-03-14 05:20 AM
  13. RodgerLeblanc's Avatar
    Hi Thurask!
    Thanks for all your efforts trying to help us out.
    I've been following what you recently said to Patrick and it works fine but when you have 2 buttons in the same line, the buttons are not aligned in the center the right way.
    I would also like to know how can I add a text line alligned in the center of the tab neither on the top side nor the bottom side only in the middle.
    And how can we get the settings tab when sliding down from the top bezel ?
    For text to align vertically, you'll need a parent Container {} with DockLayout and both horizontalAlignment and verticalAlignment set to Fill, and then in a child Container {} you set both horizontalAlignment and verticalAlignment to Center.

    Posted via CB10
    09-03-14 05:24 AM

Similar Threads

  1. Issue with my wired Headset on BB Z30
    By muindor in forum Ask a Question
    Replies: 3
    Last Post: 03-14-15, 07:36 AM
  2. Can I use BIS plan with Z10?
    By Rana Saadat Ali Khan in forum Ask a Question
    Replies: 22
    Last Post: 09-07-14, 08:35 AM
  3. Issue with contact card from within BBM
    By LyoobaBerry in forum Ask a Question
    Replies: 2
    Last Post: 08-31-14, 11:29 PM
  4. Blackberry q10 expired password issue-help!!!!!
    By CrackBerry Question in forum Ask a Question
    Replies: 1
    Last Post: 08-30-14, 06:43 PM
  5. What will be new with Amazon Appstore in 10.3?
    By hisham1996 in forum BlackBerry 10 OS
    Replies: 3
    Last Post: 08-30-14, 05:54 PM
LINK TO POST COPIED TO CLIPBOARD