Page 1 of 1

[SOLVED] addActionButton during setup...

Posted: 13 September 2015, 01:26
by Rudolf
Hello,
I have another question: is addActionButton function available to run from setup in JS?
it seems my button don't want to be created at this step...
it runs when called later in the code, but not during setup...
How did you do to create buttons on a refresh?

Code: Select all

             setup: function( gamedatas )
        {
          
            
            console.log( "Starting game setup" );
            
            this.addActionButton( 'button_patata', _('PATATATATATATA'), 'onSENButton');

         

Re: addActionButton during setup...

Posted: 13 September 2015, 14:40
by Rudolf
The only solution I find is to put this in OnEnteringState...
Then I use the call here.

Re: [SOLVED] addActionButton during setup...

Posted: 13 September 2015, 19:01
by pikiou
onUpdateActionButtons is the only place where addActionButton should be used. I think it's written in the documentation.
It's because right before onUpdateActionButtons is called, there place where action buttons are placed is cleaned up.

Edit: JesterX is right, it's onUpdateActionButtons, not onEnteringState. My bad.

Re: [SOLVED] addActionButton during setup...

Posted: 18 September 2015, 02:07
by JesterX
Personally, I use:

onUpdateActionButtons: called when entering in a new state, in order you can add action buttons in status bar.

Re: [SOLVED] addActionButton during setup...

Posted: 18 September 2015, 08:41
by Rudolf
Yes also, thanks Jester.