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
gdev001
Posts: 163
Registered: ‎01-30-2013
My Device: Blackberry 10 Simulator
Accepted Solution

Problems running the NavigationPane example

Hi, I am just trying to get a idea how to use NavigationPane in my app.

I am trying to follow this example: https://developer.blackberry.com/cascades/reference/bb__cascades__navigationpane.html
This is how my class looks like where i want to add a NavigationPane:

 
import bb.cascades 1.0

NavigationPane {
    id: navigationPane

Page {
    
    // Root Container    
    Container {
        
       ...
            
      
            
              
           CustomButton {
                  text: "Click me"
                  btnBackground: "asset:///btn-lightblue.png"
                  btnSelected: "asset:///btn-green.png"
                  bottomPadding: 12.0
                  topPadding: 12.0  
                  
                 // This is where I want the second Page to show up
                 onTouch: {
                       var page = pageDefinition.createObject();
                       navigationPane.push(page);
                     
                 }
                 
                  attachedObjects: ComponentDefinition { // where should this go?
                                               id: pageDefinition;
                                               source: "SecondDialog.qml"
                  }
                  
             
          }
          
         
    ...

    } // Container
    
} // Page
    
    onPopTransitionEnded: { page.destroy(); }

} // Navigation Pane

 But when the user clicks the "Click me" button the SecondDialog.qml does not show up... Can someone notice what am I doing wrong .... ??? Thank you.

Please use plain text.
Developer
ndsmyter
Posts: 648
Registered: ‎09-26-2012
My Device: Limited Edition Z10, Playbook 16GB/32GB, Dev Alpha A/B/C
My Carrier: Mobile Vikings

Re: Problems running the NavigationPane example

Why are you using onTouch, instead of onTriggered in your custom button?


A like is always appreciated,
but a nomination for BB Elite even more :-)
You can also contact me on Twitter: @ndsmyter
Please use plain text.
Developer
gdev001
Posts: 163
Registered: ‎01-30-2013
My Device: Blackberry 10 Simulator

Re: Problems running the NavigationPane example

hm... I don't know onTrigerred. My custom button is actually a Container... I will give it a try with onTrigerred too .. but anyway, the onTouch gets called when I click the button, because I tested it with changing the title of the button when onTouch gets called, and the title was successfully changed ...
Please use plain text.
Developer
gdev001
Posts: 163
Registered: ‎01-30-2013
My Device: Blackberry 10 Simulator

Re: Problems running the NavigationPane example

OK, it's solved, the problem was in the second page I was adding to the navigation pane, I was missing a " import bb.cascades 1.0" -- there :smileyhappy:

Please use plain text.
Developer
ndsmyter
Posts: 648
Registered: ‎09-26-2012
My Device: Limited Edition Z10, Playbook 16GB/32GB, Dev Alpha A/B/C
My Carrier: Mobile Vikings

Re: Problems running the NavigationPane example

[ Edited ]

Ah, if it is a container, then you can indeed use the onTouch method. As far as I know, buttons always work with "onTriggered".

 

Glad to hear it is solved :-)



A like is always appreciated,
but a nomination for BB Elite even more :-)
You can also contact me on Twitter: @ndsmyter
Please use plain text.
Developer
gdev001
Posts: 163
Registered: ‎01-30-2013
My Device: Blackberry 10 Simulator

Re: Problems running the NavigationPane example

yep, thanks
Please use plain text.