Solved

Message box usages

Posted on 2008-06-24
7
416 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
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

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

Independent Software Vendors: 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!

Question has a verified solution.

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

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.
Article by: Rob
Notes 8.5 Archiving Steps and Tips This article covers setting up a Notes archive, and helps understand some of the menu choices making setting up and maintaining a Notes archive file easier.
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decadeā€¦

726 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