Solved

Message box usages

Posted on 2008-06-24
7
419 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
[X]
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
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
Industry Leaders: 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

Industry Leaders: 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

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
Sometimes clients can lose connectivity with the Lotus Notes Domino Server, but there's not always an obvious answer as to why it happens.   Read this article to follow one of the first experiences I had with Lotus Notes on a client's machine, my…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

688 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