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
Developer
smiley
Posts: 1,466
Registered: ‎07-14-2008
My Device: Z10
My Carrier: Fido
Accepted Solution

Beta 4 Toast with button bug

[ Edited ]

so i have added a button to the Toast message.  Normally without the button it automatically disappears after 10 seconds but with a button it takes 1:30min before it goes away.

 

from the doc below.

 

"The toast will be dismissed after a predefined timeout period lapses. If the toast includes a button, then the timeout period is activated with the first user interaction, e.g., user touching the screen. During this time, if a button is displayed, the user can select it."

 

anyone have this problem?

 

Update:  After the toast msg is display and if I touch the screen then it will activate the timeout and then it disappears but if I let it sit there it will not go away until a very long long time.

Please use plain text.
Developer
peter9477
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: Beta 4 Toast with button bug

I haven't tried, but are you saying it will stay there for 90 seconds even if you are interacting with the screen?

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Please use plain text.
Developer
smiley
Posts: 1,466
Registered: ‎07-14-2008
My Device: Z10
My Carrier: Fido

Re: Beta 4 Toast with button bug


peter9477 wrote:
I haven't tried, but are you saying it will stay there for 90 seconds even if you are interacting with the screen?

No.  If you touch the button then it goes away but it you do not touch the screen then it just sits there.

See my updated finding above.

 

What I really wanted is to display a toast message saying "Picture Saved. | View"  View is the button.  So when the user selects the View button it will view the picture and it will time out the close if the user does nothing but the problem is it will not close like 90 seconds.

 

 

 

Please use plain text.
Developer
peter9477
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: Beta 4 Toast with button bug

The behaviour you're describing appears to be exactly what they intended. It's for cases like the "Undo" example (you've seen the screenshot) where the user might not be prepared to react instantly.

Isn't what you're observing exactly what the text you quoted describes? If so, this isn't a bug as the thread title says, even if it doesn't fit what you want it to do.

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Please use plain text.
Developer
smiley
Posts: 1,466
Registered: ‎07-14-2008
My Device: Z10
My Carrier: Fido

Re: Beta 4 Toast with button bug

Maybe I miss understood the usage.  I would expect to behave the same with or without the button.  In the screen shot it has the Undo button in their example.  It doesn't make any sense to force the user to select button.  What if the user doesn't want to undo as an example and just want to dismiss the msg?

 

Like what I want to do is allow the user the option to view otherwise just timeout and goes away.

 

In anycase I guess I won't be adding the button.  thanks peter.

Please use plain text.
Regular Contributor
Q-T
Posts: 94
Registered: ‎12-02-2011
My Device: non-Blackberry user
My Carrier: none

Re: Beta 4 Toast with button bug

Be nice to be able to set the timeout or even interupt it progamatically.  Maybe we can get this in the next release

Please use plain text.
Developer
jaiaca
Posts: 96
Registered: ‎10-06-2012
My Device: Z10
My Carrier: Rogers

Re: Beta 4 Toast with button bug

Is there an example of adding the button in the documentation? I've just glanced around but couldn't find an actual code example - can this be done in both C++ and QML?

Thanks
Jason I. Carter
Follow me @jasonicarter
Built For BlackBerry - WordsPlus & WordsPlus: Free Edition | word search has never had it so good
www.twocasualcoders.com | never casual on quality
Please use plain text.
Developer
strobejb
Posts: 276
Registered: ‎10-15-2012
My Device: bb10 developer
My Carrier: Orange

Re: Beta 4 Toast with button bug

[ Edited ]

I figured out the button in QML. IIRC it is something like this:

 

SystemToast {

 

   id: toasty

   body: "body text here"

 

  button: {

     label: "hello"

  }

 

  onFinished: {

     console.log("closing");

  }

}

 

You can use a timer to dismiss the toast automatically after X seconds

 

Please use plain text.
Developer
jaiaca
Posts: 96
Registered: ‎10-06-2012
My Device: Z10
My Carrier: Rogers

Re: Beta 4 Toast with button bug

Okay so I understand the QML aspect of it, which makes sense...But in C++ how is the button added to the toast? For example there's setBody, setIcon, etc but no setButton method
Jason I. Carter
Follow me @jasonicarter
Built For BlackBerry - WordsPlus & WordsPlus: Free Edition | word search has never had it so good
www.twocasualcoders.com | never casual on quality
Please use plain text.
Developer
strobejb
Posts: 276
Registered: ‎10-15-2012
My Device: bb10 developer
My Carrier: Orange

Re: Beta 4 Toast with button bug

I made a mistake in the qml I posted. What you need in QML is:

 

SystemToast {

 

   id: toasty

   body: "body text here"

   button.label: "hello"

 }

Please use plain text.