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

Adobe AIR Development

Reply
Highlighted
Contributor
Posts: 20
Registered: ‎06-12-2012
My Device: BlackBerry 10 Dev Alpha
My Carrier: TELE2 HR

Disable backButton in ActionBar

Hi how to disable backButton in ActionBar?

 

appActionBar.backButton = new Action( 'Back', null, {id:'back'} );
appActionBar.backButton.enabled = false;

 

This work when is called before 

 

ab.addChild(appActionBar);
this.addElement(ab);

 

 

But when I call afer this button stays enabled i even try this:

 

ab.removeChild(appActionBar);
this.removeElement(ab);
appActionBar.backButton.enabled = false;
ab.addChild(appActionBar);
this.addElement(ab);

 

 

But no luck.

 

BB10 Air Developer
Developer
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: Disable backButton in ActionBar

What happens if you:

appActionBar.backButton = null;
?

My guess is that would remove the back button.
Contributor
Posts: 20
Registered: ‎06-12-2012
My Device: BlackBerry 10 Dev Alpha
My Carrier: TELE2 HR

Re: Disable backButton in ActionBar

Hi thanks, that worked, it's a workaround. 

 

null - removes button like you wrote, but I meed to disable button (action) maybe my code work but i need something to invalidate or render or update action bar Smiley Happy 

 

but this is solution for now Smiley Happy 

BB10 Air Developer
Developer
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: Disable backButton in ActionBar

It would be nice to disable actions, but I found that I just removeAll() and then add back what is needed based on the current state of the page. Not great, but it works. It what use case do you want to prevent the user to go back to the previous page?
Developer
Developer
Posts: 227
Registered: ‎01-17-2012
My Device: PB
My Carrier: ATT

Re: Disable backButton in ActionBar

I'm having similar fun with ActionBar.

 

And I also add/remove the backButton - e.g. since my screen requires an explicit Save...

 

I chose to enable/disable Actions, rather than adding/removing: I think it would be too confusing to a user when menu items keep changing places.  That said, I cannot get the menu items to appear in a consistent order even though I always add them in the same order.

All Actions are explicityly designated as being on the bar or on the overload and I've also tried addActionAt, but the menu items are placed in seeminly random order from one invocation to the next.

 

Suggestions?

 

Regards,

Developer
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: Disable backButton in ActionBar

If you can repeat this issue, please submit a bug report and then post the bug number here so other can vote on it.
Developer
Developer
Posts: 227
Registered: ‎01-17-2012
My Device: PB
My Carrier: ATT

Re: Disable backButton in ActionBar

my bad - was loading Actions from a Dictionary...

 

Regards,

Contributor
Posts: 20
Registered: ‎06-12-2012
My Device: BlackBerry 10 Dev Alpha
My Carrier: TELE2 HR

Re: Disable backButton in ActionBar

Just to confirm. This works now.

 

appActionBar.backButton.enabled = false;

 

BB10 Air Developer