Solved

Message box usages

Posted on 2008-06-24
7
410 Views
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
0
Comment
Question by:jareddraper
  • 3
  • 3
7 Comments
 
LVL 19

Expert Comment

by:madheeswar
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
boxType& = MB_YESNO + MB_ICONQUESTION
answer% = MessageBox("Do you want to continue?", boxType&, _
  "Continue?")
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"
0
 
LVL 22

Expert Comment

by:Bill-Hanson
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

0
 

Author Comment

by:jareddraper
ID: 21886575
OK Thanks, so inc which options module do I need to include the Iconst.lss  ?
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 22

Expert Comment

by:Bill-Hanson
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.
0
 

Author Comment

by:jareddraper
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
0
 
LVL 22

Accepted Solution

by:
Bill-Hanson earned 500 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.
0
 

Author Closing Comment

by:jareddraper
ID: 31470402
Ok sounds good thanks
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

This is an old article, please see an updated version of this article, located here: http://www.experts-exchange.com/articles/23619/Notes-8-5x-Windows-7-Notes-info-and-tips.html
IBM Notes offer Encryption feature using which the user can secure its NSF emails or entire database easily. In this section we will discuss about the process to Encrypt Incoming and Outgoing Mails in depth.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

911 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now