{ "id": "62144", "key": "TIMOB-1512", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "14164", "description": "Release 3.0.2", "name": "Release 3.0.2", "archived": true, "released": true, "releaseDate": "2013-02-19" }, { "id": "14162", "description": "Release 3.1.0", "name": "Release 3.1.0", "archived": true, "released": true, "releaseDate": "2013-04-16" }, { "id": "15079", "description": "2013 Sprint 02 API", "name": "2013 Sprint 02 API", "archived": true, "released": true, "releaseDate": "2013-01-28" }, { "id": "14812", "description": "2013 Sprint 02", "name": "2013 Sprint 02", "archived": true, "released": true, "releaseDate": "2013-01-28" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2013-01-23T03:33:33.000+0000", "created": "2011-04-15T02:54:49.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "api", "module_tabgroup", "qe-review", "qe-testadded", "triage" ], "versions": [ { "id": "13505", "description": "Release 3.0.0", "name": "Release 3.0.0", "archived": true, "released": true, "releaseDate": "2012-12-14" } ], "issuelinks": [ { "id": "30302", "type": { "id": "10020", "name": "Depends", "inward": "is dependent of", "outward": "depends on" }, "inwardIssue": { "id": "116498", "key": "ALOY-724", "fields": { "summary": "Implement Ti.Android.Menu with TabGroup", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "priority": { "name": "High", "id": "2" }, "issuetype": { "id": "4", "description": "An improvement or enhancement to an existing feature or task.", "name": "Improvement", "subtask": false } } } }, { "id": "24719", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "107968", "key": "TIMOB-12307", "fields": { "summary": "Android: Refactor MenuItemProxy", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "priority": { "name": "Critical", "id": "1" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } }, { "id": "24718", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "108099", "key": "TIMOB-12335", "fields": { "summary": "Backport TIMOB-1512 to 3.0.2", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "priority": { "name": "High", "id": "2" }, "issuetype": { "id": "5", "description": "The sub-task of the issue", "name": "Sub-task", "subtask": true } } } } ], "assignee": { "name": "hpham", "key": "hpham", "displayName": "Hieu Pham", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2013-07-19T01:45:09.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10202", "name": "Android", "description": "Android Platform" } ], "description": "I've tested Option menu with normal window, it's working fine. However I can't get it working with TabGroup.\r\n\r\nTest code:\r\n{code}\r\n\r\nvar win1 = Ti.UI.createWindow({\r\n backgroundColor: 'blue',\r\n fullscreen: false\r\n});\r\nvar tab1 = Ti.UI.createTab({\r\n window: win1,\r\n title: 'Tab 1'\r\n});\r\n\r\nvar win2 = Ti.UI.createWindow({\r\n backgroundColor: 'yellow'\r\n});\r\nvar tab2 = Ti.UI.createTab({\r\n window: win2,\r\n title: 'Tab 2'\r\n});\r\n\r\nvar tabGroup = Ti.UI.createTabGroup({\r\n\tactivity: {\r\n onCreateOptionsMenu: function(e) {\r\n var menu = e.menu;\r\n var menuItem = menu.add({\r\n title : \"Item 1\",\r\n itemId: 1\r\n });\r\n var menuItem2 = menu.add({\r\n title : \"Item 2\",\r\n itemId: 2\r\n });\r\n menuItem.addEventListener(\"click\", function(e) {\r\n Ti.API.info(\"Item1 was clicked\");\r\n });\r\n menuItem2.addEventListener(\"click\", function(e) {\r\n Ti.API.info(\"Item2 was clicked\");\r\n });\r\n },\r\n \r\n onPrepareOptionsMenu: function(e) {\r\n \tvar menu = e.menu;\r\n \tif (tab1.active) {\r\n \t\tmenu.findItem(1).setVisible(false);\r\n \t\tmenu.findItem(2).setVisible(true);\r\n \t}\r\n \t\r\n \tif (tab2.active) {\r\n \t\tmenu.findItem(1).setVisible(true);\r\n \t\tmenu.findItem(2).setVisible(false);\r\n \t}\r\n }\r\n }\r\n});\r\n \r\ntabGroup.addTab(tab1);\r\ntabGroup.addTab(tab2);\r\ntabGroup.open();\r\n\r\n{code}\r\n\r\n1. Click on menu/optionMenu button, should see \"Item 2\" in tab1 and \"Item 1\" in tab2.\r\n\r\n", "attachment": [ { "id": "18008", "filename": "app.js", "author": { "name": "borey", "key": "borey", "displayName": "Borey", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:54:50.000+0000", "size": 1773, "mimeType": "application/x-javascript" } ], "flagged": false, "summary": "Android: OptionMenu is not working with TabGroup", "creator": { "name": "borey", "key": "borey", "displayName": "Borey", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "borey", "key": "borey", "displayName": "Borey", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "125898", "author": { "name": "borey", "key": "borey", "displayName": "Borey", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}
it's been 2 months, and there's no reply to this ticket. Just\nwonder if anyone has checked it.
Read the docs closer. Option menus are meant for\nwindows, not tabs. Menus are created on a\nper-window basis, but you can also recycle the menu by simply\nadding it to any window \"open\" event....
\nStick all of your menu code in a function, then add this\ncode.
\n\nwin1.addEventListener('open', function(e) {\n // add the menu here.\n addMenuToWindow();\n});
\n
\nNow (theoretically), when you switch tabs, the window also\nchanges. You need to adjust accordingly for the UI layouts. This is\nnot a bug, it is intended proper usage.
Assigning to Don for triage.