Titanium JIRA Archive
Appcelerator Community (AC)

[AC-3079] leftNavButton click event is not catched

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionInvalid
Resolution Date2011-07-08T09:22:52.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsTitanium SDK & CLI
Labelsdefect, ios, release-1.7.0, release-1.7.1
ReporterDiako Ghaderi
AssigneeTony Guntharp
Created2011-06-14T14:43:12.000+0000
Updated2016-03-08T07:48:07.000+0000

Description

The leftNavButton "click" event of a window in a navGroup is not always catched. It seems to depend if the window is entirely loaded the leftNavButton doesn't work anymore. It's of course a regression since i installed Titanium Studio with Titanium SDK 1.7.
var baseWin = Titanium.UI.createWindow({ 
    title: 'BASE'
});

var winMenu = Titanium.UI.createWindow({
	navBarHidden:		true,
	barColor: 			'#92278f',
    url:				'menu/menu.js',
    titleid:			'phone_win_menu'
});

var navGroup = Titanium.UI.iPhone.createNavigationGroup({
   window: winMenu
});

winMenu.navGroup = navGroup;
baseWin.add(navGroup);
baseWin.open({
	transition: Titanium.UI.iPhone.AnimationStyle.FLIP_FROM_LEFT
});
var winMenu = Titanium.UI.currentWindow;
	
var btnBack = Titanium.UI.createButton({
	title: 						'Back',
	color: 						'#fff',
	width: 						53,
	height: 					29,
	top:						8,
	left:						8,
	zIndex:						2
});

var btnWindow2 = Titanium.UI.createButton({
	color:  '#fff',
	color:  'Window2',
	width: 	64,
	height:	64,
	left:	70,
	top:	250
});

btnWindow2.addEventListener('click', function () {
	window2 = Titanium.UI.createWindow({
		navBarHidden:		true,
		url:				"window2.js",
		title:				"Window2",
	    titleid:			'phone_window2',
		barColor: 			'#aa5ea3',
		leftNavButton:		btnBack,
		_parent: 			winMenu,
		navGroup: 			winMenu.navGroup,
        rootWindow: 		winMenu
	});
	winMenu.navGroup.open(window2);
});
winMenu.add(btnWindow2);
var win = Titanium.UI.currentWindow;

// Ajout de l'action
win.leftNavButton.addEventListener('click', function(){
	win.hideNavBar();
	win.navGroup.close(win);
});

Comments

  1. Paul Dowsett 2011-07-05

    Diako In order for us to progress this ticket, would you please amend the code in your ticket so that it is a [proper usecase](http://wiki.appcelerator.org/display/guides/Contributing+to+Titanium#ContributingtoTitanium-CreatingGoodUsecases), that runs without modification? Please also be aware of [the Jira Ticket Checklist](http://wiki.appcelerator.org/display/guides/Contributing+to+Titanium#ContributingtoTitanium-Summary%3AtheJiraTicketChecklist). Cheers
  2. Diako Ghaderi 2011-07-06

    Thanks for your reply. I update my usecase and simplified it. I hope it will help you to fix the bug i meet with SDK 1.7.0 and 1.7.1 now.
  3. Paul Dowsett 2011-07-08

    Thanks for updating the ticket, but you may well be misusing the API. Please see [window_navbar.js](https://github.com/appcelerator/titanium_mobile/blob/master/demos/KitchenSink/Resources/examples/window_navbar.js) for the correct approach, and try running that demo (via the Kitchensink app). I will close this for now, while you check that, and reopen if necessary. Let us know. Thanks

JSON Source