Skip to main content

Using the Msgbox in Reflection 16.0

  • December 9, 2017
  • 1 reply
  • 0 views

I was fooling around with the message box function and thought I would post a few of the examples... This is by no means an all inclusive example list, but it hopefully will provide the newbie with an example of what can be done...

Sub MESSAGE_BOX5()
' Generated by the Reflection Macro Recorder on 07-22-2017 14:40:29.62.
' Generated by Micro Focus Reflection Desktop Pro (16.0.308.0).

Dim osCurrentScreen As Screen
Dim osCurrentTerminal As Terminal
Dim returnValue As Integer

Const NEVER_TIME_OUT = 0

Dim LF As String ' Chr(rcLF) = Chr(10) = Control-J
Dim CR As String ' Chr(rcCR) = Chr(13) = Control-M

Set osCurrentTerminal = ThisFrame.SelectedView.control
Set osCurrentScreen = osCurrentTerminal.Screen

LF = Chr(10)
CR = Chr(13)
' Msgbox format is as follows: Msgbox(prompt, buttons, title, helpfile, context)
'
REPLY = MsgBox("How do you do?", vbOKOnly, "This is a great day", "DEMO.HPL", 1000)
REPLY = MsgBox("How do you do 2?", vbOKCancel, "This is a great day", "DEMO.HPL", 1000)
REPLY = MsgBox("How do you do 3?", vbAbortRetryIgnore, "This is a great day", "DEMO.HPL", 1000)
REPLY = MsgBox("How do you do 4?", vbYesNoCancel, "This is a great day", "DEMO.HPL", 1000)
REPLY = MsgBox("How do you do 5?", vbYesNo, "This is a great day", "DEMO.HPL", 1000)
REPLY = MsgBox("How do you do 6?", vbRetryCancel, "This is a great day", "DEMO.HPL", 1000)
REPLY = MsgBox("How do you do 7?", vbCritical, "This is a great day", "DEMO.HPL", 1000)
REPLY = MsgBox("How do you do 8?", vbQuestion, "This is a great day", "DEMO.HPL", 1000)
REPLY = MsgBox("How do you do 9?", vbExclamation, "This is a great day", "DEMO.HPL", 1000)
REPLY = MsgBox("How do you do 10?", vbInformation, "This is a great day", "DEMO.HPL", 1000)
REPLY = MsgBox("How do you do 11?", vbDefaultButton1, "This is a great day", "DEMO.HPL", 1000)
REPLY = MsgBox("How do you do 12?", vbDefaultButton2, "This is a great day", "DEMO.HPL", 1000)
REPLY = MsgBox("How do you do 13?", vbDefaultButton3, "This is a great day", "DEMO.HPL", 1000)
REPLY = MsgBox("How do you do 14?", vbDefaultButton4, "This is a great day", "DEMO.HPL", 1000)
REPLY = MsgBox("How do you do 15?", vbApplicationModal, "This is a great day", "DEMO.HPL", 1000)
REPLY = MsgBox("How do you do 16?", vbSystemModal, "This is a great day", "DEMO.HPL", 1000)
REPLY = MsgBox("How do you do 17?", vbMsgBoxHelpButton, "This is a great day", "DEMO.HPL", 1000)
REPLY = MsgBox("How do you do 18?", vbMsgBoxSetForeground, "This is a great day", "DEMO.HPL", 1000)
REPLY = MsgBox("How do you do 19?", vbMsgBoxRight, "This is a great day", "DEMO.HPL", 1000)
'
' you can also combine buttons..
REPLY = MsgBox("Button #2 is default", vbYesNo vbDefaultButton2, "This is a great day", "DEMO.HPL", 1000)
REPLY = MsgBox("** Button #3 is now the Default **", vbYesNoCancel vbDefaultButton3, "This is a great day", "DEMO.HPL", 1000)
'
' you can branch out depending on the answser to you question
If REPLY = vbYes Then ' User chose Yes.
' set the variable 'MyString' to yes...
MyString = "Yes" ' Perform some action.
MsgBox MyString
ElseIf REPLY = vbNo Then
MyString = "No" ' Perform some action.
MsgBox MyString
Else ' user must have selected the cancel button
MyString = "CANCEL"
MsgBox MyString
End If

Exit Sub

' Recording stopped at 14:40:40.37.

End Sub

#Desktop
#Reflection

1 reply

I was fooling around with the message box function and thought I would post a few of the examples... This is by no means an all inclusive example list, but it hopefully will provide the newbie with an example of what can be done...

Sub MESSAGE_BOX5()
' Generated by the Reflection Macro Recorder on 07-22-2017 14:40:29.62.
' Generated by Micro Focus Reflection Desktop Pro (16.0.308.0).

Dim osCurrentScreen As Screen
Dim osCurrentTerminal As Terminal
Dim returnValue As Integer

Const NEVER_TIME_OUT = 0

Dim LF As String ' Chr(rcLF) = Chr(10) = Control-J
Dim CR As String ' Chr(rcCR) = Chr(13) = Control-M

Set osCurrentTerminal = ThisFrame.SelectedView.control
Set osCurrentScreen = osCurrentTerminal.Screen

LF = Chr(10)
CR = Chr(13)
' Msgbox format is as follows: Msgbox(prompt, buttons, title, helpfile, context)
'
REPLY = MsgBox("How do you do?", vbOKOnly, "This is a great day", "DEMO.HPL", 1000)
REPLY = MsgBox("How do you do 2?", vbOKCancel, "This is a great day", "DEMO.HPL", 1000)
REPLY = MsgBox("How do you do 3?", vbAbortRetryIgnore, "This is a great day", "DEMO.HPL", 1000)
REPLY = MsgBox("How do you do 4?", vbYesNoCancel, "This is a great day", "DEMO.HPL", 1000)
REPLY = MsgBox("How do you do 5?", vbYesNo, "This is a great day", "DEMO.HPL", 1000)
REPLY = MsgBox("How do you do 6?", vbRetryCancel, "This is a great day", "DEMO.HPL", 1000)
REPLY = MsgBox("How do you do 7?", vbCritical, "This is a great day", "DEMO.HPL", 1000)
REPLY = MsgBox("How do you do 8?", vbQuestion, "This is a great day", "DEMO.HPL", 1000)
REPLY = MsgBox("How do you do 9?", vbExclamation, "This is a great day", "DEMO.HPL", 1000)
REPLY = MsgBox("How do you do 10?", vbInformation, "This is a great day", "DEMO.HPL", 1000)
REPLY = MsgBox("How do you do 11?", vbDefaultButton1, "This is a great day", "DEMO.HPL", 1000)
REPLY = MsgBox("How do you do 12?", vbDefaultButton2, "This is a great day", "DEMO.HPL", 1000)
REPLY = MsgBox("How do you do 13?", vbDefaultButton3, "This is a great day", "DEMO.HPL", 1000)
REPLY = MsgBox("How do you do 14?", vbDefaultButton4, "This is a great day", "DEMO.HPL", 1000)
REPLY = MsgBox("How do you do 15?", vbApplicationModal, "This is a great day", "DEMO.HPL", 1000)
REPLY = MsgBox("How do you do 16?", vbSystemModal, "This is a great day", "DEMO.HPL", 1000)
REPLY = MsgBox("How do you do 17?", vbMsgBoxHelpButton, "This is a great day", "DEMO.HPL", 1000)
REPLY = MsgBox("How do you do 18?", vbMsgBoxSetForeground, "This is a great day", "DEMO.HPL", 1000)
REPLY = MsgBox("How do you do 19?", vbMsgBoxRight, "This is a great day", "DEMO.HPL", 1000)
'
' you can also combine buttons..
REPLY = MsgBox("Button #2 is default", vbYesNo vbDefaultButton2, "This is a great day", "DEMO.HPL", 1000)
REPLY = MsgBox("** Button #3 is now the Default **", vbYesNoCancel vbDefaultButton3, "This is a great day", "DEMO.HPL", 1000)
'
' you can branch out depending on the answser to you question
If REPLY = vbYes Then ' User chose Yes.
' set the variable 'MyString' to yes...
MyString = "Yes" ' Perform some action.
MsgBox MyString
ElseIf REPLY = vbNo Then
MyString = "No" ' Perform some action.
MsgBox MyString
Else ' user must have selected the cancel button
MyString = "CANCEL"
MsgBox MyString
End If

Exit Sub

' Recording stopped at 14:40:40.37.

End Sub

#Desktop
#Reflection
marshallgrads,

It appears that in the past few days you have not received a response to your
posting. That concerns us, and has triggered this automated reply.

These forums are peer-to-peer, best effort, volunteer run and that if your issue
is urgent or not getting a response, you might try one of the following options:

- Visit https://www.microfocus.com/support-and-services and search the knowledgebase and/or check
all the other self support options and support programs available.
- Open a service request: https://www.microfocus.com/support
- You could also try posting your message again. Make sure it is posted in the
correct newsgroup. (http://forums.microfocus.com)
- You might consider hiring a local partner to assist you.
https://www.partnernetprogram.com/partnerfinder/find.html

Be sure to read the forum FAQ about what to expect in the way of responses:
http://forums.microfocus.com/faq.php

Sometimes this automatic posting will alert someone that can respond.

If this is a reply to a duplicate posting or otherwise posted in error, please
ignore and accept our apologies and rest assured we will issue a stern reprimand
to our posting bot.

Good luck!

Your Micro Focus Forums Team
http://forums.microfocus.com