Donations Welcome

I am currently saving toward a new version of Paint Shop Pro. If you wish to help me out, then please donate.

Larger versions of images can be seen by clicking on the image. Also, thank you for your kind and encouraging comments. I love reading the comments. If you use my any of freebies, I would be overjoyed with a comment containing a link to your item. I love seeing any of my freebies in use.

Friday, August 1, 2008

Message Boxes in Scripts

There are three types of message boxes in Paint Shop Pro scripts: the information box, the question box, and the stop box.


Code Snippet:

result = App.Do(Environment, 'MsgBox', {
'Buttons': App.Constants.MsgButtons.OK,
'Icon': App.Constants.MsgIcons.Info,
'Text': 'This is an OK button with an informational icon.',
})




Code Snippet:

result = App.Do(Environment, 'MsgBox', {
'Buttons': App.Constants.MsgButtons.YesNo,
'Icon': App.Constants.MsgIcons.Question,
'Text': 'These are Yes and No buttons with a question mark icon.',
})




Code Snippet:

result = App.Do(Environment, 'MsgBox', {
'Buttons': App.Constants.MsgButtons.OKCancel,
'Icon': App.Constants.MsgIcons.Stop,
'Text': 'These are Ok and Cancel buttons with a stop sign icon.',
})


The results from the message box are stored in the variable 'result'. The MsgBox produces one value. The value will either be 1 or 0. The 'result' variable can be used in the if clause to allow switching between choices.

To change the type of buttons on the message box, you change the word after .MsgButtons. The options are OK, OKCancel, or YesNo.
   result = App.Do(Environment,  'MsgBox', {
'Buttons': App.Constants.MsgButtons.YesNo,
'Icon': App.Constants.MsgIcons.Question,
'Text': 'These are Yes and No buttons with a question mark icon.',
})
To change the picture on the message box, you change the word after .MsgIcons. The options are Info, Question, or Stop.
   result = App.Do(Environment,  'MsgBox', {
'Buttons': App.Constants.MsgButtons.YesNo,
'Icon': App.Constants.MsgIcons.Question,
'Text': 'These are Yes and No buttons with a question mark icon.',
})
To change the text in a message box you may edit anything between the two single quotes after Text.
   result = App.Do(Environment,  'MsgBox', {
'Buttons': App.Constants.MsgButtons.YesNo,
'Icon': App.Constants.MsgIcons.Question,
'Text': 'These are Yes and No buttons with a question mark icon.',
})

1 comment:

  1. Thank You so much for this tutorial and sharing God will bless you for all that you do... I am happy I was referred to your site.

    ReplyDelete