Attach PopUp to toolbar's two state button

Is it possible to show popup when clicking on the two state button?

I tried with the following code:

toolbarWin.attachEvent('onStateChange', function(bId, state) { if(bId == 'buttonWinRepeat' && state === true ) { myPop.show(bId); } })

But it is not showing.

Please, try to call the myPop.show with a timeout:
toolbarWin.attachEvent(‘onStateChange’, function(bId, state) {
if(bId == ‘buttonWinRepeat’ && state === true ) {
setTimeout(function() {myPop.show(bId);}, 50)
}
})

I did as you suggested, but unfortunately I get the following error:

[code]TypeError: this.conf.id is undefined

…ts=function(j){var a=false;for(var h=0;h<this.conf.id.length;h++){if(this.conf.i…

[/code]

So, please, try to:
toolbarWin.attachEvent(‘onStateChange’, function(bId, state) {
if(bId == ‘buttonWinRepeat’ && state === true ) {
setTimeout(function() {myPop.show(‘buttonWinRepeat’);}, 50)
}
})