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
Posts: 813
Registered: ‎05-29-2012
My Device: see later
My Carrier: see later
Accepted Solution

Import another qml fle

I have Header.qml

 

import bb.cascades 1.2


    Container {
        topPadding: 20
        leftPadding: 20
        rightPadding: 20
        layoutProperties: StackLayoutProperties { spaceQuota: -1 } 
        horizontalAlignment: HorizontalAlignment.Center
        ImageView {
            imageSource: "asset:///images/ic_logo_black.png"
        
        }
    }


 

 

wanna import it here

 

import bb.cascades 1.2
import "Header"

Page {
    Container {
        background: Color.LightGray
        
        Header 
        {
            id:header
        }
        Container {
            
            
            preferredWidth: DisplayInfo.width
            leftPadding: 20
            rightPadding: 20
            bottomPadding: 20
            //   preferredHeight: (DisplayInfo.height-(((DisplayInfo.width-50)/3.71)+20))-60
            layout: StackLayout {
                orientation: LayoutOrientation.BottomToTop
            }
            layoutProperties: StackLayoutProperties {
                spaceQuota: 1
            }
            
            Container {
                rightPadding: 20.0
                leftPadding: 20.0 
                topPadding: 10 
                layout: StackLayout {
                    orientation: LayoutOrientation.LeftToRight
                }
                
                Button {
                    rightMargin: 10
                    layoutProperties: StackLayoutProperties {
                        spaceQuota: 1
                    }
                    imageSource: "asset:///images/ic_help.png"
                    text: "Help"
                
                }
                
                Button {
                    rightMargin: 10
                    layoutProperties: StackLayoutProperties {
                        spaceQuota: 1
                    }
                    imageSource: "asset:///images/ic_phone.png"
                    text: "Contact us"
                
                } 
               
            }
            Container {
                rightPadding: 20.0
                leftPadding: 20.0 
                topPadding: 10 
                layout: StackLayout {
                    orientation: LayoutOrientation.LeftToRight
                }
                Button {
                    rightMargin: 10
                    layoutProperties: StackLayoutProperties {
                        spaceQuota: 1
                    }
                    imageSource: "asset:///images/ic_marker.png"
                    text: "ATM Locator"
                }
                Button {
                    rightMargin: 10
                    layoutProperties: StackLayoutProperties {
                        spaceQuota: 1
                    }
                    imageSource: "asset:///images/ic_display.png"
                    text: "Full Website"
                }
                
                
              
            
                
            }
            Container {
                rightPadding: 20.0
                leftPadding: 20.0 
                topPadding: 10 
                layout: StackLayout {
                    orientation: LayoutOrientation.LeftToRight
                }
                
                Button {
                    rightMargin: 10
                    layoutProperties: StackLayoutProperties {
                        spaceQuota: 1
                    }
                    imageSource: "asset:///images/ic_user.png"
                    text: "Login"
                }
                Button {
                    rightMargin: 10
                    layoutProperties: StackLayoutProperties {
                        spaceQuota: 1
                    }
                    imageSource: "asset:///images/ic_id.png"
                    text: "Register"
                }
                
               
            }
        }
    }
}

 

 

 

bolded part i get  import folder does not exist

 

 

Developer
Posts: 813
Registered: ‎05-29-2012
My Device: see later
My Carrier: see later

Re: Import another qml fle

both files are at same path. under assetts
Developer
Posts: 1,524
Registered: ‎12-18-2012
My Device: Z30, Z10 LE, DevAlpha C, PlayBook

Re: Import another qml fle

If they're in the same folder, import is not needed. Simply use the file.

Andrey Fidrya, @zmeyc on twitter
Developer
Posts: 813
Registered: ‎05-29-2012
My Device: see later
My Carrier: see later

Re: Import another qml fle

still does not work, it gives me on Header { id:header }

eader does not have any property set for accessibility (title, subtitle, accessibility.labelledBy, accessibility.name)


and when i run it on bb...it gives me on top empty white space.
Developer
Posts: 541
Registered: ‎05-17-2009
My Device: Not Specified

Re: Import another qml fle

What is the path to your Header.qml file?

Developer
Posts: 813
Registered: ‎05-29-2012
My Device: see later
My Carrier: see later

Re: Import another qml fle

it worked

i changed my qml file into TopHeader.qml

and instead of Header I used TopHeader

Probably Header is sthg built in already.and was overwritting my qml file
Developer
Posts: 541
Registered: ‎05-17-2009
My Device: Not Specified

Re: Import another qml fle

and also:

 

What is the path to the file you want to import Header into?

Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: Import another qml fle

I can confirm this is true, Header is already used for ListViews...

 

http://developer.blackberry.com/native/reference/cascades/bb__cascades__header.html

 

Don't feel bad though as I too made the same mistake about a year ago and it took me some time to work out why it wasn't working. Smiley Happy

 


If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.