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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Regular Contributor
Posts: 56
Registered: ‎03-02-2012
My Device: 9780 & Playbook 32GB & Dev Alpha
My Carrier: Vodafone GR

ToggleButton coding question

ToggleButton {
id: play
checked: false
onCheckedChanged : {
myApp.playSound ("anthem.wav");
}

 

 

 What i need to add so when the button goes back to off , the app stops playing the sound?

totaly new in cascades. 

 

 

Developer
Posts: 849
Registered: ‎03-03-2011
My Device: Z10

Re: ToggleButton coding question

Theoretically:

 

ToggleButton 
{
   id: playButton
   checked: false
   onCheckedChanged: 
      {
          if (playButton.checked)
          {
             myApp.playSound("anthem.wav");
          }
          else
          {
             myApp.stopSound();
          }
      }
}

 

--------------------------------------------------------------------------------------
Leader of Ljubljana BlackBerry Developer Group
BlackBerry Certified Builder for Native Application Development
Regular Contributor
Posts: 56
Registered: ‎03-02-2012
My Device: 9780 & Playbook 32GB & Dev Alpha
My Carrier: Vodafone GR

Re: ToggleButton coding question

nice try but no.it is not working.

 

Retired
Posts: 329
Registered: ‎05-07-2012
My Device: BB Alpha
My Carrier: N/A

Re: ToggleButton coding question

Hi,

 

 

The suggestion posted by suaman should fire the correct signals from the QML side, however, we cannot help you unless we know what you are calling in your routines;

 

Could you share the contents of your "playSound" and "stopSound" methods? Are you able to reach breakpoints in your stopSound routine using suaman's suggestion?

 

Martin

 

Regular Contributor
Posts: 56
Registered: ‎03-02-2012
My Device: 9780 & Playbook 32GB & Dev Alpha
My Carrier: Vodafone GR

Re: ToggleButton coding question

it is actually a copy of cowbell sample app.

i just add a togglebutton and i want to play the wav on changed, and stop when toggle button is unchecked. 

 

Developer
Posts: 262
Registered: ‎07-13-2012
My Device: PlayBook, DA B, DA C, LE Z10 #102, Q10, Z30
My Carrier: T-Mobile

Re: ToggleButton coding question

myApp.playSound ("anthem.wav"); is a call to a C++ function named "playSound" with context property "myApp" so what do you have in your .cpp file and .hpp file(s)?  Take a look at the files in the "src" folder in cowbell sample app.

---
Check out my BB10 Cascades Coding site: BBcascades.com & Cascades Blog: bbcascadescode.tumblr.com

My Built for BlackBerry app: The Dive Plan
Retired
Posts: 499
Registered: ‎05-07-2012
My Device: developer
My Carrier: developer

Re: ToggleButton coding question