Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-1010] Ti.Android.OptionMenu.Menu doesn't respect title property change

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2011-04-17T01:54:56.000+0000
Affected Version/sn/a
Fix Version/sRelease 1.4.0
ComponentsAndroid
Labelsandroid, defect, menu
ReporterKonstantin
AssigneeBlain Hamon
Created2011-04-15T02:41:26.000+0000
Updated2011-04-17T01:54:56.000+0000

Description

Platform 1.3.0, Android 2.1

I have a "heavyweight" android window with menu attached. I try to change "title" property of one menu items, after click. Something like:

Controller.prototype.onMenuClick = function(e) {
  e.source.title = 'New title based on some condition';
}
but it doesn't work. Title is same.

Comments

  1. Don Thorp 2011-04-15

    We'll look into this, but the native Tab control does not allow changes after creation.

  2. Konstantin 2011-04-15

    Don,
    It's not a Tab, it's an Android Menu

  3. Don Thorp 2011-04-15

    Ok this appears to be that the source is not what you're expecting. We'll definitely look into it.

  4. Matthew Lenton 2011-04-15

    I'm on it, though a tip or source to reproduce this would be helpful.

  5. Don Thorp 2011-04-15

    Most likely the onPropertyChange didn't get implemented for title and/or icon. Basically you need an app.js that creates a menu. You don't even need to worry about a windows. Just in the onclick of them menu change the title of the item. Then when you press the menu button again, it should show the new title.

    Please check icon as well.

  6. Don Thorp 2011-04-15

    We've verified that setting the menu title and icon do function as expected. You need to set your listener on the actual object not its prototype. We inject objects in Javascript from the native side and they're effectively wrappers around native objects. In that respect they don't "obey" prototype as you're expecting.

  7. Konstantin 2011-04-15

    Don,
    No, it's not a problem of prototype, I have my own event manager, which keeps context and allows to attach and pass custom data to event handlers. All objects inside event handler are valid, event handler is executed and it works everywhere across project.

    I'll prepare simple project to reproduce this bug.

  8. Konstantin 2011-04-15

    Ooops, Don and Matthew, I'm very sorry, I found stupid bug in my source code. From now, I'll check my bug report more carefully.

    Sorry again

JSON Source