Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-12983] BlackBerry: TabGroup.activeTab and Tab.active

GitHub Issuen/a
TypeSub-task
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2013-03-19T02:04:02.000+0000
Affected Version/sn/a
Fix Version/sRelease 3.1.0, 2013 Sprint 06 BB, 2013 Sprint 06
ComponentsBlackBerry
Labelsn/a
ReporterJosh Roesslein
AssigneeJosh Roesslein
Created2013-03-06T21:40:15.000+0000
Updated2017-03-08T18:25:22.000+0000

Description

Implement the TabGroup.activeTab and Tab.active properties and set/get methods. These allow developers to determine if or what tab in a group is currently active. Developers may also set this property to true/false to toggle which tab is active.

Acceptance Test

var tabGroup = Ti.UI.createTabGroup();
 
var tab1 = Ti.UI.createTab({
  title: 'A tab.',
  window: Ti.UI.createWindow({backgroundColor: 'blue'})
});
tabGroup.addTab(tab1);
 
var tab2 = Ti.UI.createTab({
  title: 'Another tab.',
  window: Ti.UI.createWindow({backgroundColor: 'red'})
});
tabGroup.addTab(tab2);
 
tabGroup.open();
 
function logTabInfo() {
  Ti.API.info('active tab: ' + tabGroup.activeTab.title);
  Ti.API.info('1st tab active: ' + tab1.active);
  Ti.API.info('2nd tab active: ' + tab2.active);
}

logTabInfo();

// Switch to the second tab after a few seconds.
setTimeout(function() {
  tab2.active = true;
  logTabInfo();

  // Switch back to the first tab after another few seconds.
  setTimeout(function() {
    tabGroup.activeTab = tab1;
    logTabInfo();
  }, 3000);
}, 3000);

Run the application and verify the 1st tab (blue background) is visible.

The following should be printed to the log:

"active tab: A tab." "1st tab active: true" "2nd tab active: false"

After 3 seconds the second tab (red background) should become active.

Verify the following is printed to the log:

"active tab: Another tab." "1st tab active: false" "2nd tab active: true"

After 3 seconds the first tab (blue background) should become active again.

Verify the same logs listed in step #2 is printed.

Comments

  1. Lee Morris 2017-03-08

    Closing ticket as resolved.

JSON Source