Tag Archives: message
Dr. Claudio Soto
Contributed samples and applications by Dr. Claudio Soto
A simple way to modify the cursor …
Change BACKCOLOR of SPLITCHILD Window
Rate this:
SP_MSG
() Short: ------ MSG() Displays up to a 9 line message in a window Returns: -------- Nothing Syntax: ------- MSG(c1,[c2,c3,c4,c5,c6,c7,c8,c9]) Description: ------------ Displays in a popup box up to 9 lines of a message <c1..c9>. Then waits for a keypress or optionally a time-out. First parameter can be a number equaling a time-out value in seconds Examples: --------- MSG("An error has been detected",; "...don't move!") MSG("A","B","C","D","E","F") MSG(5,"A","B","C","D","E","F") Notes: ------- Message is centered on screen in a box Once message is displayed, waits for keypress and then removes window, restoring screen underneath. Or waits for time-out value. Source: ------- S_MSG.PRG
Rate this:
SP_GENVAL
GENVAL() Short: ------ GENVAL() Generic VALID clause validation with message Returns: -------- <lValid> => logical result of passed condition Syntax: ------- GENVAL(expValid,expMessage) Description: ------------ Evaluates <expValid>, which is either a bode block or a string to be macro expanded, as a logical value. If result is False, displays message <expMessage> and waits for a keypress. <expMessage> can be a single string, or an array of strings (see aMsg() ). Examples: --------- if genval("fcount() < 60",'Too many fields') COPY TO TEMP endif * ...or as a VALID CLAUSE macro'd @10,10 get lname VALID ; GENVAL("!empty(lname)","Need a last name") * ...or as a VALID CLAUSE eval'd @10,10 get fname VALID ; GENVAL( { || !empty(fname) },"Need a last name") Source: ------- S_GENVA.PRG
Rate this:
SP_AMSG
AMSG() Short: ------ AMSG() Pop up message box for an array of messages Returns: -------- Nil Syntax: ------- aMsg(aMsgs,[cTitle],[cFooter],[lCenter],[cColor],[nTop,nLeft]) Description: ------------ Pops up a box to display messages in <aMsgs>. Each element of <aMsgs> can be of type Character, Numeric, Date or Logical. The box is centered in the middle of the screen by default. [cTitle] is an optional title string displayed at <nTop>,<nLeft+1> [cFooter] is an optional footer string displayed at <nBottom>, <nLeft+1>. Default footer is "Press a key.." [lCenter] determines center messages in box or not. by default, message lines are left justified. Passing True causes messages to be centered. [cColor] is the color of the popup box. By default, is sls_popcol() [nTop,nLeft] are optional TOP/LEFT dimensions for the box. Default is centered on the screen, and big enough to hold all of the message lines. Examples: --------- aArray := {"Attention:","all items are on sale for",1.99,; "today only",date()} amsg(aArray,"Sale",nil,.t.) Notes: ------- If there are more message lines than will fit in the box, up/down arrows will scroll the messages. See MSG() Source: ------- S_AMSG.PRG
Rate this:
FT_PROMPT
FT_PROMPT() Define a menu item for use with FT_MenuTo() Syntax #include "FTMENUTO.CH" @ <nRow>, <nCol> PROMPT <cPrompt> ; [COLOR <cColor>] ; [MESSAGE <cMessage>] ; [MSGROW <nMsgRow>] ; [MSGCOL <nMsgCol>] ; [MSGCOLOR <cMsgColor>] ; [TRIGGER <nTrigger>] ; [TRIGGERCOLOR <cTriggerColor>] ; [HOME <nHome>] ; [END <nEnd>] ; [UP <nUp>] ; [DOWN <nDown>] ; [LEFT <nLeft>] ; [RIGHT <nRight>] ; [EXECUTE <bExec>] ; Arguments <nRow> is the row at which the prompt is to appear. <nCol> is the column at which the prompt will appear. <cPrompt> is the menu item string. <cColor> is optional and is the color attribute of the prompt. Note that two colors are required; one for the standard setting and one for the enhanced setting (i.e. the light bar color). See the example below if this isn't clear. If <cColor> is not specified then the current SetColor() value is used by default. <cMessage> is optional and is the message associated with the prompt. If not specified, then no message will be displayed. <nMsgRow> is optional and is the row at which the message, if any, will appear. If not specified, the default is the current setting of the SET MESSAGE TO command. <nMsgCol> is optional and is the column at which the message, if any, will appear. If not specified, the default is either zero or centered, depending on the current setting of the CENTER option of the SET MESSAGE TO command. <cMsgColor> is optional and is the color attribute of the message. If not specified, the default is the same as the prompt color. <nTrigger> is optional and is the position within the prompt string where the trigger character is located. If not specified, the default is one. <cTriggerColor> is optional and is the color attribute of the trigger character. Note that two colors are required; one for the standard setting and one for the enhanced setting (i.e. the light bar color). See the example below if this isn't clear. If <cTriggerColor> is not specified then the default is the same color as the rest of the prompt. <nHome> is optional and specifies which prompt becomes active when the home key is pressed. If not specified, the default is the first prompt. <nEnd> is optional and specifies which prompt becomes active when the end key is pressed. If not specified, the default is the last prompt. <nUp> is optional and specifies which prompt becomes active when the up arrow key is pressed. If not specified, the default is the previous prompt. The current setting of SET WRAP TO is obeyed. <nDown> is optional and specifies which prompt becomes active when the down arrow key is pressed. If not specified, the default is the next prompt. The current setting of SET WRAP TO is obeyed. <nRight> is optional and specifies which prompt becomes active when the right arrow key is pressed. If not specified, the default is the next prompt. The current setting of SET WRAP TO is obeyed. <nLeft> is optional and specifies which prompt becomes active when the left arrow is pressed. If not specified, the default is the previous prompt. The current setting of SET WRAP TO is obeyed. <bExec> is optional and is a code block to evaluate whenever the menu item to which it belongs is selected. Description Clipper's @...PROMPT and MENU TO commands are fine as far as they go. But many times you need more flexibility. As you'll no doubt notice if you read the argument list, this function is almost completely flexible. You can adjust locations and colors for every part of the prompt and its associated message. In addition, since you can control the effect of the arrow keys, you can allow both horizontal and vertical movement, or even disable certain arrow keys if you so desire. Support for nested menus is also available, since the prompts are stored in stack-based static arrays. Note that this command can also be called using function-style syntax. See the entry for FT_PROMPT() for further details. This enhanced version of @...PROMPT requires the inclusion of the header file FTMENUTO.CH in any source file that uses it. It is may be used in place of the standard Clipper @...PROMPT command. However, in the interests of functionality it is NOT 100% compatible. No whining! If compatibility is such a big deal then use the standard Clipper commands. Examples #include "FTMENUTO.CH" // Simple prompt @ 1, 1 PROMPT "Menu choice #1" // Prompt with color @ 3, 1 PROMPT "Menu choice #2" COLOR "W+/R,W+/B" // Prompt with a message @ 5, 1 PROMPT "Menu choice #3" MESSAGE "Go to lunch" // Prompt with pinpoint message control @ 7, 1 PROMPT "Menu choice #4" MESSAGE "Drop Dead" ; MSGROW 22 MSGCOL 4 MSGCOLOR "GR+/N" // Prompt with a trigger character ("#" character) @11, 1 PROMPT "Menu choice #6" TRIGGER 13 // Prompt with trigger character color control @13, 1 PROMPT "Menu Choice #7" TRIGGER 13 TRIGGERCOLOR "R+/BG,G+/N" // Prompt with right and left arrow keys disabled @15, 1 PROMPT "Menu Choice #8" RIGHT 8 LEFT 8 Header File: FTMENUTO.CH Source: MENUTO.PRG Author: Ted Means
Rate this:
FT_DISPMSG
() Display a message and optionally waits for a keypress Syntax FT_DISPMSG( <aMessageArray>, [ <cKey2Check> ], [ <nTopBoxRow> ], [ <nLeftBoxColumn> ], [ <cBoxType> ], [ <lShadow> ] ) -> lKeyMatch Arguments <aMessageArray> is a multidimensional array of messages to be displayed and the color attributes for each message. The first dimension of the array contains one or more elements, each representing one line in the message box, up to the maximum number of rows on the screen. The second dimension of the array contains a color attribute for the corresponding element in dimension one, plus one additional element for the color of the box border. Dimension two will always contain one more element than dimension one. If an attribute is omitted, the last color selected will be used. <Key2Check> is a character string of one or more keys to check for. If omitted, the message is displayed and control is returned to the calling procedure. If one character is specified, FT_DISPMSG() waits for one keypress, restores the screen and returns. If multiple characters are specified, FT_DISPMSG() remains in a loop until one of the specified keys has been pressed, then restores the screen and returns. <nTopBoxRow> is the upper row for the message box. If omitted, the box is centered vertically. <nLeftBoxColumn> is the leftmost column for the box. If omitted, the box is centered horizontally. <cBoxType> is a string of characters or a variable for the box border. See the @...BOX command. If omitted, a double box is drawn. <lShadow> is a logical variable. If true (.T.) or omitted, it uses FT_SHADOW() to add a transparent shadow to the box. If false (.F.), the box is drawn without the shadow. Returns If <Key2Check> is not specified, FT_DISPMSG() will return false (.F.). If <Key2Check> is a one-character string, FT_DISPMSG() will return true (.T.) if the user presses that key, or false (.F.) if any other key is pressed. If <Key2Check> consists of multiple characters, it will lock the user in a loop until one of those keys are pressed and return the INKEY() value of the keypress. Description FT_DISPMSG() is a multi-purpose pop-up for user messages. Multiple lines may be displayed, each with a different attribute. The box will be automatically centered on the screen, or the row and/or column can be specified by the programmer. It also centers each line of the message within the box. Examples The following example displays a simple two-line message and returns immediately to the calling routine. FT_DISPMSG( { { "Printing Report" , ; "Press [ESC] To Interrupt" } , ; { "W+/B*", "W/B", "GR+/B" } } ) The next example displays a message and waits for a key press. FT_DISPMSG( { { "Press [D] To Confirm Deletion" , ; "Or Any Other Key To Abort" } , ; { "W+/B", "W+/B", "GR+/B" } } , ; "D" ) The next example displays a one-line message centered on row 5 and returns to the calling procedure. FT_DISPMSG( { { "Please Do Not Interrupt" } , ; { "W+/B", "GR+/B" } } , ; , 5, ) Source: DISPMSG.PRG Author: Paul Ferrara
Rate this:
FT_BLINK
FT_BLINK() Display a blinking message on the screen Syntax FT_BLINK( <cMsg>, [ <nRow> ], [ <nCol> ] ) -> NIL Arguments <cMsg> is the string to blink. <nRow> is an optional screen row for @...SAY, default current. <nCol> is an optional screen col for @...say, default current. Returns NIL Description A quick way to blink a msg on screen in the CURRENT colors. Restores colors on return. Examples FT_BLINK( "WAIT", 5, 10 ) // Blinks "WAIT" in current colors @ 5,10 @5,10 SAY "WAIT - Printing Report" FT_BLINK( "..." ) // Blink "..." after wait message... Source: BLINK.PRG Author: Terry Hackett
Rate this:
: Send
: Send--binary (Object) ------------------------------------------------------------------------------ Syntax <object>:<message>[(<argument list>)] Type Object Operands <object> is the name of the object that is to receive the message. <message> is the name of a method or instance variable. <argument list> is a list of parameters that are passed to the specified message. The parentheses surrounding the argument list are optional if no parameters are supplied in the message send. By convention, however, parentheses distinguish a message send with no parameters from an access to an exported instance variable. Description Each class defines a set of operations that can be performed on objects of that class. Perform these operations by sending a message to the object using the send operator (:). When a message is sent to an object, the system examines the message. If the object is of a class that defines an operation for that message, the system automatically invokes a method to perform the operation on the specified object. If the class does not define a method for the specified message, a runtime error occurs. Executing a message send produces a return value, much like a function call. The return value varies depending on the operation performed. Examples . In this example, myBrowse is the name of a variable that contains a TBrowse object reference. pageUp() is a method that specifies the operation to be performed. The available operations and corresponding methods vary depending on the class of the object. The Error, Get, TBColumn, and TBrowse classes are documented in this chapter. myBrowse:pageUp() . This example forces the checkbox state to true (.T.): myCheck : Select (.T.)
Rate this:
HMG Samples
Language Related
Arrays
Conversion
DOS -> Windows Character Conversion
National Issues
National Alternate Collating Sequence
Windows
Controls
Browse
Combo box
Edit Box
Grid
Text Box
Search in and Fill Box (SFilBox)
Tree
Functions
Drives, Directories and Files
PutFile() with default file name
Messages
Improvements in Message functions
Miscellaneous
Funny
Drawing
Printing
Text Mode
GUI Mode
HMG Print
HMG Print ( Mini Print ) for beginners in 10 easy steps
Print a plain text file by HMG Print – 1
HMG Report
HMG HPDF
Unicode
Utilities