home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
100 Great Games for Palm OS 1
/
100PalmV1.iso
/
Cards
/
pocketjack
/
msgbox_fo.cpk
< prev
next >
Wrap
Text File
|
1999-03-06
|
7KB
|
256 lines
# package file providing menu options for full screen size
# about and help message boxes
# 30aug98, ver 0.1, frank o'brien, dianfrank@worldnet.att.net,
# http://home.att.net/~dianfrank/casl_page.htm
# freeware, no warranty, copyright
# 21nov98, ver 0.2, fob
# added more comments to help with useage
# added control variables for multiple form programs
# 27nov98, fob
# polished the credits for other cpk files in about text
# 6mar99, ver 0.3, fob
# added function so can redraw objects after reshow of main
# frame, in case auto redraw of graphics last, covers objects
# USER GUIDE
# Main form details:
#
# This package file provides menu options for:
# Help
# Help...
# About...
#
# main form must be called frMain
# Include order:
#
# In order that Help topmenu appear at right end of main program
# menu, the include statement for this package must appear after
# include statements defining other menu options.
# Public/Private:
#
# The code that's intended for changing by user, is labeled public.
# Code that the user should not have to change/call is labeled
# private. There is no such thing in CASL, it's a note to the user.
# mb_bDisable, mb_bVerbose:
#
# Help/About menu option will hide frMain, show frMsgBox, and display
# help/about string. Because it's assumed frMain is always the
# active frame, programs with multiple frames can use the mb_bDisable
# flag to make the menu option unavailable. If mb_bVerbose is set,
# a messagebox function will appear to explain event detected but
# disabled. If not set, event is ignored without message.
# mb_sTitle, ..., mb_sDocName:
#
# About string is built based on mandatory string tokens defined by
# user for each program, and optional string tokens which might
# stay the same for each developer. By default About string will
# indicate that program is freeware, etc. See mb_InitAbout for
# details on About string.
# mb_sHelpBody:
#
# Help string is built based on optional string tokens mb_sDocName and
# mb_sHelpBody defined by user for each program. If both are left blank,
# full Help string defaults to "See source code". See mb_InitHelp
# for details on Help string.
# mb_AppendAbout:
#
# means to credit authors for the package and/or library files your
# program uses. as a writer of a package file, you could provide
# a Initialization function which would make use of this function,
# and would be called by main startup function for appending credit
# information to end of about text.
# VARIABLES - PUBLIC
variables;
# control variables
# use in multiple form programs to disable help topmenu
numeric mb_bDisable=false();
# show message when help topmenu selected but disabled,
# only active if mb_bDisable=true()
numeric mb_bVerbose=true();
# about/help string tokens,
# define in main module, can use mb_lf for starting new line,
# normally done in startup function
string mb_sTitle;
string mb_sVersion;
string mb_sDate;
string mb_sAbstract;
# redefine in main module only if need to change defaults
# replace with name of user manual, if available
string mb_sDocName="source code";
# define with brief help string, if desired
string mb_sHelpBody;
# add library modules to rt string, if needed
string mb_sRTVersion="CASLrt 2.6x";
string mb_sPrice="Freeware, no warranty";
# developer info, might define once, and save as msgbox_xx.cpk,
# where xx might be your initials
string mb_sWebSite="http://home.att.net/~dianfrank/casl_page.htm";
string mb_sAuthor="Frank O'Brien";
string mb_sMail="dianfrank@worldnet.att.net";
end;
# VARIABLES - PRIVATE
variables;
# constants, don't change
string mb_sAbout; # let module build, see mb_InitAbout
numeric mb_bAboutDefined=false();
string mb_sHelp; # let module build, see mb_InitHelp
string mb_lf=char(10)+char(10);
string mb_end=mb_lf+" - o -"+mb_lf;
end;
# OBJECTS - PRIVATE, MENU for frMain
menu_top mtHelp, frMain;
display "Help";
end;
menu_item miHelp, mtHelp;
display "Help...";
end;
menu_item miAbout, mtHelp;
display "About...";
end;
# OBJECTS - PRIVATE, HELP/ABOUT MESSAGE FRAME
frame frMsgBox;
hidden;
end;
text mb_lbMsgText, frMsgBox;
position 50,100;
pixel_size 900,700;
no_input;
scrollbar top;
end;
button mb_btOK, frMsgBox;
position 400,900;
pixel_size 250,75;
display "OK";
end;
# FUNCTIONS - PUBLIC
# call in main program startup function to append package or
# library file information to standard about box text
# appends to front of string, main program about info appended last,
# so appears first when displayed
#
function mb_AppendAbout(string s);
mb_sAbout=s+mb_end+mb_sAbout;
end;
# FUNCTIONS - PRIVATE
# build about and help strings
function mb_InitAbout;
# give credit to me for msgbox package, thanks
call mb_AppendAbout("Help and About box functions provided by "+
"msgbox_ii.cpk, ver 0.3, 6mar99, Frank O'Brien, "+
"http://home.att.net/~dianfrank/casl_page.htm");
# main program credit, appended to front last, so displayed first
mb_sAbout=mb_sTitle+", "+mb_sVersion+mb_lf
+mb_sAbstract+mb_lf+"Requires "+mb_sRTVersion+mb_lf
+char(169)+" "+mb_sDate+", "+mb_sAuthor+", "+mb_sMail+mb_lf
+mb_sPrice+", see "+mb_sDocName+" for details. For "
+"updates, visit "+mb_sWebSite+mb_end+mb_sAbout;
end;
function mb_InitHelp;
if mb_sHelpBody<>"";
mb_sHelp=mb_sHelpBody+mb_lf;
end_if;
mb_sHelp=mb_sHelp+"See "+mb_sDocName+" for details."+mb_end;
end;
# handle show business
function mb_ShowHelp;
put frMsgBox, "Help";
show frMsgBox;
# after show, forces scrollbar show
if mb_sHelp="";
call mb_InitHelp;
end_if;
put mb_lbMsgText, mb_sHelp;
end;
function mb_ShowAbout;
put frMsgBox, "About";
show frMsgBox;
# after show, forces scrollbar show
if not mb_bAboutDefined;
call mb_InitAbout;
mb_bAboutDefined=true();
end_if;
put mb_lbMsgText, mb_sAbout;
end;
function mb_ShowNo(string title);
variables;
numeric mb;
end;
mb=message_box(0,title,"Not available. "+
"Possible cause, only available from main form",
"","OK","");
end;
# pilot evidently redraws objects then graphics, if your program
# has graphics that cover objects after reshow frame, redefine
# this function is your program to reshow the objects
#
function mb_Redraw;
end;
# INVOKER FUNCTIONS - PRIVATE, MESSAGE FRAME
# swaps main and message box frames, and ok button
# reverses swap
#
function miHelp;
if mb_bDisable;
if mb_bVerbose;
call mb_ShowNo("Help");
end_if;
else;
hide frMain;
call mb_ShowHelp;
end_if;
end;
function miAbout;
if mb_bDisable;
if mb_bVerbose;
call mb_ShowNo("About");
end_if;
else;
hide frMain;
call mb_ShowAbout;
end_if;
end;
function mb_btOK;
hide frMsgBox;
show frMain;
call mb_Redraw;
end;