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. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Adobe AIR Development

Reply
Contributor
AmonRaHR
Posts: 20
Registered: ‎06-12-2012
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
Please use plain text.
Developer
jtegen
Posts: 6,233
Registered: ‎10-27-2010
My Carrier: AT&T

Re: Disable backButton in ActionBar

What happens if you:

appActionBar.backButton = null;
?

My guess is that would remove the back button.
Please use plain text.
Contributor
AmonRaHR
Posts: 20
Registered: ‎06-12-2012
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 :smileyhappy: 

 

but this is solution for now :smileyhappy: 

BB10 Air Developer
Please use plain text.
Developer
jtegen
Posts: 6,233
Registered: ‎10-27-2010
My Carrier: AT&T

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?
Please use plain text.
Trusted Contributor
mdd
Posts: 199
Registered: ‎01-17-2012
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,

Please use plain text.
Developer
jtegen
Posts: 6,233
Registered: ‎10-27-2010
My Carrier: AT&T

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.
Please use plain text.
Trusted Contributor
mdd
Posts: 199
Registered: ‎01-17-2012
My Carrier: ATT

Re: Disable backButton in ActionBar

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

 

Regards,

Please use plain text.
Contributor
AmonRaHR
Posts: 20
Registered: ‎06-12-2012
My Carrier: TELE2 HR

Re: Disable backButton in ActionBar

Just to confirm. This works now.

 

appActionBar.backButton.enabled = false;

 

BB10 Air Developer
Please use plain text.