Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot modify body of UI.Card within click handler #56

Closed
otbe opened this issue May 15, 2015 · 6 comments
Closed

Cannot modify body of UI.Card within click handler #56

otbe opened this issue May 15, 2015 · 6 comments

Comments

@otbe
Copy link

otbe commented May 15, 2015

Hi,

its not possible for me to change the body of a UI.Card element within a click handler or ajax callback. I try something like that:

var screen = new UI.Card({
      title: 'Name',
      body: 'Test',
      action: {
        up: 'images/action_icon_plus.png',
        down: 'images/action_icon_minus.png'
      }
    }); 

screen.on('click', 'up', function() {
    screen.body('Test2');
});

screen.show();

The body changes to 'Test2' but the app crashes with no log output.
Whats wrong with my attempt?

Im using cloudpebble with a Pebble Steel (latest firmware).

Meiguro added a commit that referenced this issue May 15, 2015


Aplite requires an app chrome refresh hack that falsely triggers the
appear and disappear handlers. This causes all resources on-screen to be
deallocated. Fix the appear and disappear handling to only clear
resources when it is a true apppear or disappear.
@Meiguro
Copy link

Meiguro commented May 15, 2015

Very sorry about that! I just made a fix. The patch notes explains the issue briefly. I'll close this when it's merged into CloudPebble.

@otbe
Copy link
Author

otbe commented May 15, 2015

Thank you very much. I'll be waiting for the merge :)

@andreipopovici
Copy link

Hi there,

Strangely, I have a similar issue almost exactly a year later :) Here's the code:

var UI = require('ui');
var Voice = require('ui/voice');

var card = new UI.Card({
  title:'Ready',
  body:'Press Select to dictate'
});

card.on('click', function(e) {
    Voice.dictate('start', true, function(e) {
      card.title('');
      card.subtitle('Heard:');
      card.body(e.transcription);
    });
});

card.show();

This crashes without log output (doesn't help that CloudPebble returns a 403 for the debug.json from Heroku!).

I'm compiling on Chalk using Pebble.js in CloudPebble, firmware v3.12 on my PTR.

Ninja edit: well ain't that something. I just recompiled and ran the exact same code now, and it doesn't crash anymore. Wonder what changed in the last hour... Huh.

Either way, leaving this here for reference in case it happens to anyone else.

@Meiguro
Copy link

Meiguro commented May 24, 2016

Ah yes, this is a problem with the voice window not being a normal window. I've created a new ticket for this issue, I'll try to think of something to fix it! #165

I'll post in this ticket too when I fix the issue.

@Meiguro
Copy link

Meiguro commented May 24, 2016

As for the original issue, the fix is now merged in CloudPebble.

@Meiguro Meiguro closed this as completed May 24, 2016
@andreipopovici
Copy link

Thanks for taking a look! Just to be clear, when you say the fix is merged in CloudPebble, do I get the latest merged version each time I compile? Do I need to change anything else anywhere?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants