I want to change the messageBox behaviour in my script

Hello,

I have a script that looks like this:

macroScript AutoBackToggle
	category:"Haider"
	buttonText:"AB-Toggle"
	toolTip:"AutoBackup Toggle"
(
	on isChecked do (autoBackup.enabled)
 
	on execute do 
	if autoBackup.enabled == true then 
	(
		autoBackup.enabled = false 
		/*print (autoBackup.enabled)*/
		messageBox "Autobackup disabled." title:"Autobackup State" beep:false
	)
	else 
	(
		autoBackup.enabled = true
		/*print (autoBackup.enabled)*/
		messageBox "Autobackup enabled." title:"Autobackup State" beep:false
	)
)

The messageBox command will lock the user, forcing one to press OK before continuing.
How do I change the popup to be a regular information popup that doesn't "lock" the viewport?

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Haider of Sweden's picture

.

I noticed some strange behaviours

- the rollout shows up upon Max startup, before I have pressed the button.
- rollout reappears even though I close it

Kind regards
Haider
www.haider.se

barigazy's picture

...

But if you looking better solution then try this

bga

Haider of Sweden's picture

.

@But if you looking better solution then try this
I emailed you last time because I had some problems. It still doesnt work with me. Will look into it again and return to you with complete report on what happens.

Thanks for the fix
Could you please add so that if I dont close the popup, but press the button again, it kills the popup and recreats it, showing the right message?

Kind regards
Haider
www.haider.se

barigazy's picture

...

Try with this

-- change this line
on isChecked do (msgRollPopup() ; autoBackup.enabled)

bga

Haider of Sweden's picture

.

Almost done.
It needs to destroy the previous popup too :)

Kind regards
Haider
www.haider.se

barigazy's picture

...

I wrote this on the phone. I can't test it

-- next cahnge this
global msgRollPopup,msgRoll

bga

barigazy's picture

...

BTW you need to learn mxs very quick. Read mxs help document.
You have too meny questions :)

bga

Haider of Sweden's picture

.

@BTW you need to learn mxs very quick. Read mxs help document.
You have too meny questions :)

You're so right. I am trying to catch up learning. Until then, I am at your mercy ;)
I made these changes to make it work:

global msgRollPopup,bgaRoll
..
..
try(destroyDialog ::bgaRoll)catch()
..
..
createDialog bgaRoll 150 26 style:#(#style_titlebar, #style_sysmenu, #style_toolwindow)

Kind regards
Haider
www.haider.se

barigazy's picture

...

It was you :)
I don't know what is the problem, really.

bga

Haider of Sweden's picture

.

It was you :)
I don't know what is the problem, really.

Hehe, yep :)
We'll check it later again.

Could you please add so that if I dont close the popup (red x), but press the toolbar-button again, it kills the old popup and recreats it, showing the right message?

Kind regards
Haider
www.haider.se

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.