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: 358
Registered: ‎04-13-2013
My Device: Z10
My Carrier: Telus

Setting onTriggered when switching tabs

[ Edited ]

I currently have two tabs.  I want to disable the visibility of one of the children in the first tab whenever I go to the second tab, then enable to visibility when i go back to the first tab.  The reasons for this is that my first tab is a mapview and for some reason it causes me some grief with mapviews in other sheets (like 1/4 of the mapview shows the active mapview from tab 1) whenever I go into activeframe and back to the app.  Disabling the visibility of the mapview in the first tab seems to rectify the issue.

 

So TL;DR i wan to make the mapview visibility = false when i click on the second tab, then make it true when I click back onto the first tab.  I've tried adding onTriggered { mapview.visibile(false)} to the second tab, but it doesn't do anything.

 

My code is:

 

Tab {

container {

Mapview {
id:mapview
}

}

}

Tab {

}
Developer
Posts: 17,025
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Setting onTriggered when switching tabs

mapview.visibile = false would be the correct code.
Check if onTriggered is called by using console.log
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Developer
Posts: 358
Registered: ‎04-13-2013
My Device: Z10
My Carrier: Telus

Re: Setting onTriggered when switching tabs

debug shows that the trigger is being registered but the the mapview isn't going visible=false Smiley Sad

Developer
Posts: 17,025
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Setting onTriggered when switching tabs

can you access the mapview id from there? check if you can log mapview.visible to the console, for example.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Developer
Posts: 358
Registered: ‎04-13-2013
My Device: Z10
My Carrier: Telus

Re: Setting onTriggered when switching tabs

[ Edited ]

when I do console.log(mapview.visible) it gives me 'false',  Looks like it's just giving me the value that I put in the trigger.  So it would seem that i cannot access the mapview ID.

 

here's the trigger code:

 

Tab {
id: tab2
        onTriggered: {
            
            mapview.visible = false
            console.log("trigger worked")
            console.log(mapview.visible)
        }
.......
}

 

Retired
Posts: 252
Registered: ‎08-17-2012
My Device: BlackBerry Z10 and Q10
My Carrier: Bell

Re: Setting onTriggered when switching tabs

[ Edited ]

Hi bmorr, you can try loading your MapView dynamically using ComponentDefinition and createObject() onTriggered of the Tab where you want to show it. For more information on dynamic loading of QML components, please go to this link. And for the QML signals of the Tab API, please visit this link.

@SamarAbdelsayed

Did this answer your question? Please accept post as solution.
Please refrain from posting new questions in solved threads.
Found a bug? Report it using the Issue Tracker
Highlighted
Developer
Posts: 358
Registered: ‎04-13-2013
My Device: Z10
My Carrier: Telus

Re: Setting onTriggered when switching tabs

Thank you I will check that out and mark as solved if it works.