Widget Library - Tab Bar 'pressButton' method doesn't seem to exist?

Hi - I’m using the widget library to create a tab bar, all working nicely, but I need to use the function ‘pressButton’ documented here http://developer.anscamobile.com/reference/index/widgetnewtabbar

The thing is, I get an error “attempt to call method ‘pressButton’ (a nil value)” when I call the function.

My code snippet:

tabBar = widget.newTabBar{
top=GtbDims.top, – my tab bar top y value
buttons=tabButtons – table storing the tab bar
}
tabBar:pressButton(1)

It all works fine, tabs working etc, but the call to pressButton always gives that error. Have I done something stupid, or does the function not exist?

Thanks! [import]uid: 93610 topic_id: 18520 reply_id: 318520[/import]

You caught that one fast!

It was just added as of build 2011.700 :slight_smile: [import]uid: 52430 topic_id: 18520 reply_id: 71039[/import]

Ha! Excellent, thanks, will get the latest build.

Please feel free to keep on delivering functionality just as I need it :wink: [import]uid: 93610 topic_id: 18520 reply_id: 71043[/import]

And it works!

Thanks a lot for the quick response.

[import]uid: 93610 topic_id: 18520 reply_id: 71044[/import]

Hi - I just downloaded the new (.723) build, with the changes to the widget library (ie now they are display objects themselves) and have my code working with just one issue:

The pressButton method on the tabBar seems to have changed - it used to be that calling it without a second parameter resulted in the button appearing pressed, but the listener function not being called. Now, it seems that the listener function is always called (even if you pass in ‘false’ as the second parameter) - so I can’t set one of my buttons to be down without the listener being called.

Please can you confirm if this is now how it is going to work, or if this is just a bug which will be fixed? Either way is fine, it’s easy enough to get around, but I won’t change my code if this is just a temporary thing.

Thanks!

Harry [import]uid: 93610 topic_id: 18520 reply_id: 79158[/import]

@harry: The change to pressButton is that the ‘invokeListener’ argument is by default true instead of false.

There is a bug in current builds that prevents you from setting the argument to false, however, we have fixed the bug and the changes will be available in the next daily build (after 2012.724).

As a reminder (for when the build is available), the invokeListener argument will be set to true by default unless you explicitly set it to false. This is due to the fact that it is more common to want to invoke the listener than it is to not when activating the down/pressed state of the tab button. [import]uid: 52430 topic_id: 18520 reply_id: 79301[/import]