[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now


Message box usages

Posted on 2008-06-24
Medium Priority
Last Modified: 2013-12-18
I am looking to use message boxes more with the msgbox function, does anyone have any good samples or guidelines for this, for now just simples Yes, No, Cancel functions would be good, thanks
Question by:jareddraper
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
LVL 19

Expert Comment

ID: 21863402
If you have designer installed, in the designer help, look for "MessageBox function and statement" topic.
From designer help:
Example 1
' Display the message "Do you want to continue?"
' in a message box labeled "Continue?" and containing
' Yes and No buttons. Assign the return value from
' the MessageBox function to the variable answer.
%Include "lsconst.lss"
Dim boxType As Long, answer As Integer
answer% = MessageBox("Do you want to continue?", boxType&, _
Example 2
' Use the MessageBox statement to display a
' multiline message in a message box labeled "Demo"
' and containing an OK button.
%Include "lsconst.lss"
Dim twoLiner As String
twoLiner = |This message
is on two lines|
MessageBox twoLiner, MB_OK, "Demo"
LVL 22

Expert Comment

ID: 21886200
Here's a simple example using MB_YESNOCANCEL.  Be sure to add the following line to the Options module so that the constants will be recognized by the compiler.

%INCLUDE "lsconst.lss"
	Select Case Msgbox("Click a button:", MB_YESNOCANCEL + MB_ICONQUESTION, "Title")
	Case IDYES: Msgbox("you clicked Yes")
	Case IDNO: Msgbox("you clicked No")
	Case IDCANCEL: Msgbox("you clicked Cancel")
	End Select

Open in new window


Author Comment

ID: 21886575
OK Thanks, so inc which options module do I need to include the Iconst.lss  ?
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 22

Expert Comment

ID: 21886787
For each LotusScript hotspot (action, button, etc) there is only one Options module.  At a minimum, you should see the following modules in any clickable-control:  Options, Declarations, Click, Initialize, Terminate.  Select the Options module, and paste the next line in:

%INCLUDE "lsconst.lss"

Then, paste your own code in the Click module.

Author Comment

ID: 21886811
Yeah that's what I thought, but when I try to put that in my options module I get this error

test: (Options); 1 : PUBLIC is not allowed in this module

test is the name of my button
LVL 22

Accepted Solution

Bill-Hanson earned 2000 total points
ID: 21887156
OK, sorry, my bad.

The error you are getting is correct because lsconst.lss declares the constants as Public, but you can't declare anything as Public in a button (since no other objects have visibility into the button).  You can still use the include statement, but you have to put it in a Public module that your button has access to.  For example, in a form, you would place it in the (Globals) Options module.

You have 3 options.

1) Start using LotusScript libraries.  Once you have code in a library, you can use it anywhere regardless of whether the library includes Public objects.  I would recommend creating a simple LotusScript library that has your reusable code as well as this include statement.  Then, just add a Use statement in the (Globals) Options module of the form (or view, page, etc) that contains your button.

2) Paste the include statement directly in the (Globals) Options module of the button's parent (ie: view, form, page).  Since the button is contained by the form (or view, page, etc), it has access to anything in the (Globals) section.

3) Don't use the constants.  The integer values of these constants are listed in the help file.  You can achieve the same results by using the integers instead of the constants, but your code will be harder to read.

Author Closing Comment

ID: 31470402
Ok sounds good thanks

Featured Post

Tech or Treat! - Giveaway

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For Desktop Techs: How to retain a user's Notes configuration data when swapping out the end user's computer. (Assuming that you are not upgrading to a completely different version of Notes client) All you need to do is: 1) install Notes o…
Notes Document Link used by IBM Notes is a link file which aids in the sharing of links to documents in email and webpages. The posts describe the importance and steps to create a Lotus Notes NDL file in brief.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question