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
Highlighted
Developer
Posts: 136
Registered: ‎01-25-2010
My Device: Z30, Z10, Q10, Dev Alpha B & Bold 9900
My Carrier: Bell
Accepted Solution

Referencing QML control one level lower.

I've always gotten arround without this requirement, but I'm curious to know how this can be accomplished.

 

 

asset > Main.qml

asset > EditPage.qml

asset > controls > CustomListView.qml

asset > controls > MyItem.qml



Main.qml :

 

import "controls"

Page { CustomListView: { ... } }

 
CustomListView.qml :

Container 
{
    
    ListView 
    {
        id: myListView
        
        listItemComponents: [
            
           
            ListItemComponent 
            {
                MyItem {}
            }  
        ]
    }
}

 

MyItem.qml :

 

Container 
{   
    id: Item
    verticalAlignment: VerticalAlignment.Center
    horizontalAlignment: HorizontalAlignment.Center
    
    
    Label
    {
        text: ListItemData.title
    }
    
    
    contextActions: [             
        ActionSet 
        {                                
            title: ListItemData.title
 
            
            ActionItem 
            {
                title: Edit    
                              
                onTriggered: 
                {
                    editSheet.Open();
                }
                
                attachedObjects:[
                    
                    EditPage
                    {
                        id: editSheet
                    }
                ]
            }
        }                     
    ] 
}

 
The EditPage control cannot be resolved because it resides one level lower than MyItem. Is it possible to reference a control / page that has lower visibility ? How can this be accomplished ?

Developer
Posts: 508
Registered: ‎01-19-2011
My Device: My Trusty Red Plane
My Carrier: Outer Space

Re: Referencing QML control one level lower.

try adding

 

import "../"

 to your MyItem.qml

-----------------------------------------------------------------------
I'm a bird from outer space. But I'm not flappy o.o
Developer
Posts: 136
Registered: ‎01-25-2010
My Device: Z30, Z10, Q10, Dev Alpha B & Bold 9900
My Carrier: Bell

Re: Referencing QML control one level lower.

That was simple... Thanks for the quick response !