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
Tobster_
Posts: 270
Registered: ‎07-20-2012
My Device: Blackberry Z10 (White), BlackBerry Dev Alpha C

onActiveTabChanged Query

Hello, 

 

I am currently using a WebView on two tabs within my application. The second WebView has this URL:

 

url: eBayUK.url + "/deals"

 

eBayUK is the ID of the first WebView and so the second tab loads /deals of whatever the current URL is of the first Webview but this causes an issue as when the user is on a different page on the first tab the second tab loads /deals whenever the first tab loads a page which leads to the same page then being displayed on the second tab. All I want to be displayed on the second tab is, for example, ebay.co.uk/deals 

 

Is there a way, with onActiveTabChanged, to load that WebView only when the user goes onto the second tab? 

 

Thanks :smileyhappy:

Developer
Benecore
Posts: 540
Registered: ‎08-31-2013
My Device: Q10, Z10LE, Nokia N950, DAB....

Re: onActiveTabChanged Query

Load the second tab as dynamic object. You can use the Delegate component.

for example:

.......
Tab {
      id: secondTab
      delegate: Delegate {
          id: tabDelegate
          source: "secondTab.qml"
      }
      delegateActivationPolicy: TabDelegateActivationPolicy.ActivateWhenSelected
  } 
...............

 

  • ActivateWhenSelected:The tab content is loaded (active set to true) when the tab is selected and never deleted during the lifetime of the object. Since the content is never deleted, performance is impacted only the first time the tab is selected.

for more info

https://developer.blackberry.com/native/documentation/cascades/ui/navigation/multiple_screens_tabs.h...

 

Then just load the url inside the onCreationCompleted signal

 

This is just one workaround. Is many others :Punk:

Hope it helps

 



If helped give a like. If your problem was solved mark the post as "Solution"
Portfolio: BlackBerry Nokia
Social: Twitter | Facebook
About Me / Blog DevPDA | Blog