Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
New Developer
Posts: 25
Registered: ‎09-13-2012
My Device: Playbook, Z10, Z30, Q10, Q5
My Carrier: None

Strange behavior in QML

I found a strange behavior in my app.
I'll try to be as clear as possible within the limitations of my english Smiley Happy.

I have a game in which process the data within the qml, once you complete a level, the result is sending to a c++ function (a procces whit scoreloop) and this, once completed, through a callback triggers a signal in qml.

Until this instance it all going great… the function in qml that receives the signal runs but does not reflect changes in qml sometimes.

Basically the function is this:

 

function showBt() {
        console.log(“show the button”);
        //
        btContinue.enabled = true;
        btContinue.visible = true;
        //
        indicator.visible = false;
        indicator.enabled = false;
        indicator.running = false;
// console.log(“btContinue.visible ”+btContinue.visible); }

It toggles the visibility of a button and an indicator, I always see the console message "shows the button" and "btContinue.visible true” but sometimes (I mean, not always) does not show the button… unless you touch the screen trying to minimize the app or open the upper menu, time when the button is again visible (WTF?).

It's like the graph of the app will freeze (not as well because the indicator is still moving)

Anyone know about this behavior or know a solution (even if not much “elegant” Smiley Happy

 

Thanks!

___________________________________

I am in a strange new world...
Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: Strange behavior in QML

Have you checked you are not receving the signal multiple times?


If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.
New Developer
Posts: 25
Registered: ‎09-13-2012
My Device: Playbook, Z10, Z30, Q10, Q5
My Carrier: None

Re: Strange behavior in QML

Yes, I only receive the signal once.
Also try to shoot the signal again with a timer but also stays frozen until I touch the screen.
I repeat, this only happens sometimes randomly and I get no other errors in the console Smiley Frustrated
___________________________________

I am in a strange new world...
Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: Strange behavior in QML

I think we'd have to see more of the code, any chance you can cut it down to a bare essentials example and post it here?

The only thing I've seen that is similar is when multiple signals come in quickly hence the question.

If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.
Developer
Posts: 508
Registered: ‎01-19-2011
My Device: My Trusty Red Plane
My Carrier: Outer Space

Re: Strange behavior in QML

when are you setting your btContinue to visible = false? Sounds to me like a race condition if it only happens sometimes

 

Like, most of the times the button is invisible first, and then set to visible.

But sometimes (for whatever reason), it is set to visible first, but set to invisible right after

 

Otherwise, you need to post the essentials of your code

-----------------------------------------------------------------------
I'm a bird from outer space. But I'm not flappy o.o
Highlighted
New Developer
Posts: 25
Registered: ‎09-13-2012
My Device: Playbook, Z10, Z30, Q10, Q5
My Carrier: None

Re: Strange behavior in QML

Hi pyth and bbsjdev, I set btContinue to visible = false when I hide the popup that contains the button.

 

Already discard the possibility of that happening.

 

I'll try to detail some of the steps:

Create the signal in QML

onCreationCompleted: {
        /*code*/
        _scoreloop.continueGame.connect(resultado.showBt); //CONNECT SIGNAL
    }

When I finish a game level check the result and sending the result

 

function checkResult(){
        /*code process the result*/
        _scoreloop.sendScore(points); //CALL FUNCTION IN C++
    }

 In c++ process and sending the result to scoreloop and this returns a callback

void ScoreloopData::SubmitScoreCompletionCallback(void* cookie, SC_Error_t completionStatus) {

	/*code check if everything is ok*/

	qDebug() << "Done submitting Score";  //THIS IS TRACED IN THE CONSOLE

	emit self->continueGame(); //TRIGGER THE FUNCTION IN QML

}

 The function that displays the button

function showBt() {
        console.log("show the button"); //THIS IS TRACED IN THE CONSOLE
        //
        btContinue.enabled = true;
        btContinue.visible = true;
        //-- indicator
        indicator.visible = false;
        indicator.enabled = false;
        indicator.running = false;
	   //
        console.log(“btContinue.visible ”+btContinue.visible); //THIS IS TRACED IN THE CONSOLE “TRUE”
    }

 that's it, nothing unusual that I believe, most of the time it works well I want to emphasize that.

 

But sometimes it does not work and repeat: if you touch the screen trying to minimize the app or open the upper menu, the button is again visible (already setting visible = true).

 

Maybe it's a bug, which would not be unusual...

 

What do you think?

___________________________________

I am in a strange new world...
New Developer
Posts: 12
Registered: ‎03-09-2011
My Device: Z10
My Carrier: T-mobile

Re: Strange behavior in QML

Hi,

I have a quite similar behaviour. See my post here:

 

http://supportforums.blackberry.com/t5/Native-Development/Display-not-updated-when-propertyMap-chang...

 

The problem does not only afffect propertyMap but all updates to the display. I tried A LOT of things and

suggestions during the last monthes without success.  This is still unsolved.

 

Michael

The famous Movie Quiz:
http://appworld.blackberry.com/webstore/content/34285892/?lang=en&countrycode=DE