A_CHOICE() Psuedo function to simplify FT_ACH2TB() FT_ACH2TB() Replace ACHOICE() with a Tbrowse object & multiple features. FT_ADDER() Pop up a simple calculator FT_BLINK() Display a blinking message on the screen FT_BRWSWHL() Browse an indexed database limited to a while condition FT_CLRSEL() User Selectable Colour Routine FT_DISPMSG() Display a message and optionally waits for a keypress FT_FILL() Declare menu options for FT_MENU1() FT_MENU1() Pulldown menu system FT_MENU2() Vertical lightbar menu FT_MENUTO() Execute light bar menu using prompts created with @...PROMPT FT_PENDING() Display same-line pending messages after a wait. FT_PICKDAY() Picklist of days of week FT_PROMPT() Define a menu item for use with FT_MenuTo() FT_SLEEP() Wait for a specified amount of time FT_XBOX() Display a self-sizing message box and message
Tag Archives: FT_MENU1()
FT_PICKDAY
FT_PICKDAY() Picklist of days of week Syntax FT_PICKDAY() -> cDayOfWeek Arguments None Returns Character string containing day of week Description This function is ideal if you need the user to select a day. Examples mday := FT_PICKDAY() Source: PICKDAY.PRG Author: Greg Lief
FT_PENDING
FT_PENDING() Display same-line pending messages after a wait. Syntax FT_PENDING ( <cMsg>, [ <nRow> ], [ <nCol> ], ; [ <nWait> ], [ <cColor> ] ) -> NIL Arguments <cMsg> is the message string to display. <nRow> is an optional screen row for message display, default row 24. <nCol> is an optional screen col for message display, default col 0. <nWait> is an optional wait (sec) between messages, default 5 sec. <cColor> is an optional color string for displayed messages, default is white text over red background. Returns NIL Description A good way to display information messages during the running of an application is to send them all to the SAME line on the screen where users are expected to look for them. In order to give users a chance to read the current message before the next one is displayed we may need to insert a delay after each message. FT_PENDING() function displays messages by keeping track of the time of the last message and providing a delay ONLY if the next pending message is issued much too soon after the current one. Examples FT_PENDING("Message one",20,0,3,"W+/G") // Displays "Message one." // sets row to 20, col to 0. // wait to 3 and color to // bright white over green. FT_PENDING("Message two") // Displays "Message two", after 5 sec. FT_PENDING("Message three") // Displays "Message three", after 5 sec. Note that default row, col, wait time and color need to be set only once in the very first call to FT_PENDING() and only if the internal default values are not appropriate. Source: PENDING.PRG Author: Isa Asudeh
FT_MENUTO
FT_MENUTO() Execute light bar menu using prompts created with @...PROMPT Syntax #include "FTMENUTO.CH" MENU TO <var> [COLD] Arguments <var> is the name of the variable to which the result of the menu selection should be assigned. [COLD] is optional and if specified indicates that trigger characters should be treated as "cold," i.e. rather than causing the menu item to be selected it only causes the light bar to move to that selection. Description This enhanced version of MENU TO requires the inclusion of the header file FTMENUTO.CH in any source file that uses it. It may be used in place of the standard Clipper MENU TO command. However, in the interests of functionality it is NOT 100% compatible (in particular, you should make sure that the target memvar exists before executing the menu -- the Clipper version will create a PRIVATE memvar for you if it does not already exist, but this version does not). No whining! If compatibility is such a big deal then use the standard Clipper command. Note that this command can also be called using function-style syntax. See the entry for FT_MENUTO() for further details. Examples #include "FTMENUTO.CH" // Simple command MENU TO memvar Header File: FTMENUTO.CH Source: MENUTO.PRG Author: Ted Means
See Also: @…PROMPT
FT_MENU2
FT_MENU2() Vertical lightbar menu Syntax FT_MENU2( <aMenuarray> [, <cColors> ] ) -> NIL Arguments <aMenuarray> is an array of menu options, messages, and action blocks. Each element in this array is a nested array with the structure: element[x, 1] = menu option element[x, 2] = message to be displayed when option is highlighted element[x, 3] = code block to be executed when option is selected <cColors> is a string containing colors for the prompts, in the same format as that returned by Set( _SET_COLOR ). If not supplied, colors default to the current color setting. Returns NIL Description This function greatly simplifies the process of displaying light-bar menus. All prompts are padded out with spaces so they are the same length, a box is drawn around the prompts, the box is automatically centered on the screen, and the underlying screen is restored after a menu selection has been made. Additionally, because you can tie action blocks to each menu option, you can save on a lot of DO CASE or IF..ELSEIF code in your main program. See the test code for a succinct demonstration. Examples LOCAL mainmenu := ; { { "Data Entry", "Enter data", { || FT_MENU2(datamenu) } }, ; { "Reports", "Hard copy", { || FT_MENU2(repmenu) } }, ; { "Maintenance","Reindex files",{ || FT_MENU2(maintmenu) } }, ; { "Quit", "See ya later" } } FT_MENU2(mainmenu) Source: VERTMENU.PRG Author: Greg Lief
FT_MENU1
FT_MENU1() Pulldown menu system Syntax FT_MENU1( <acBarNames>, <acOptions>, <acAction>, <acColors> [, <nTopRow> ], [ <lShadow> ] ) -> NIL Arguments <acBarNames> is a character array containing the names to appear on the menu bar. <acOptions> is a multi-dimensional array with one element for each selection to appear on the pulldown menus. <acColors> is an array containing the colors for the menu groups. <nTopRow> is a numeric value that determines the row for the menu bar. If omitted, it defaults to 0. <lShadow> is a logical variable. If true (.T.) or omitted, it uses FT_SHADOW() to add a transparent shadow to the each pulldown menu. If false (.F.), the menu is drawn without the shadow. All arguments except nTopRow and lShadow are required. Returns NIL Description FT_MENU1() is a function that displays a pulldown menu for each item on the menu bar and executes the corresponding function for the item selected. When a called function returns false, FT_MENU1 returns control to the calling program. Valid keystrokes and their corresponding actions: Home - Activates Pulldown for first item on the menu bar End - Activates Pulldown for last item on the menu bar Left Arrow - Activates next Pulldown to the left Right Arrow - Activates next Pulldown to the right Tab - Same as Right Arrow Shift-Tab - Same as Left Arrow Page Up - Top item on current Pulldown menu Page Down - Bottom item on current Pulldown menu Enter - Selects current item Alpha Character - Moves to closest match and selects Alt-<Key> - Moves to corresponding menu bar item Escape - Prompts for confirmation and either returns to the calling routine or resumes Examples // Declare arrays LOCAL aColors := {} LOCAL aBar := { " ENTER/EDIT ", " REPORTS ", " DISPLAY " } // Include the following two lines of code in your program, as is. // The first creates aOptions with the same length as aBar. The // second assigns a three-element array to each element of aOptions. LOCAL aOptions[ LEN( aBar ) ] AEVAL( aBar, { |x,i| aOptions[i] := { {},{},{} } } ) // fill color array // Box Border, Menu Options, Menu Bar, Current Selection, Unselected aColors := IF( lColor, {"W+/G", "N/G", "N/G", "N/W", "N+/G"}, ; {"W+/N", "W+/N", "W/N", "N/W","W/N"} ) // array for first pulldown menu FT_FILL( aOptions[1], 'A. Execute A Dummy Procedure' , {|| fubar()}, .t. ) FT_FILL( aOptions[1], 'B. Enter Daily Charges' , {|| .t.}, .f. ) FT_FILL( aOptions[1], 'C. Enter Payments On Accounts', {|| .t.}, .t. ) // array for second pulldown menu FT_FILL( aOptions[2], 'A. Print Member List' , {|| .t.}, .t. ) FT_FILL( aOptions[2], 'B. Print Active Auto Charges' , {|| .t.}, .t. ) // array for third pulldown menu FT_FILL( aOptions[3], 'A. Transaction Totals Display', {|| .t.}, .t. ) FT_FILL( aOptions[3], 'B. Display Invoice Totals' , {|| .t.}, .t. ) FT_FILL( aOptions[3], 'C. Exit To DOS' , {|| .f.}, .t. ) Call FT_FILL() once for each item on each pulldown menu, passing it three parameters: FT_FILL( <cMenuSelection>, <bCodeBlock>, <lSelectable> <cMenuSelection> is a character string which will be displayed on the pulldown menu. <bCodeBlock> should contain one of the following: A function name to execute, which in turn should return .T. or .F. FT_MENU1 WILL RETURN CONTROL TO THE CALLING PROGRAM IF .F. IS RETURNED OR CONTINUE IF .T. IS RETURNED. .F. WHICH WILL CAUSE FT_MENU1 TO RETURN CONTROL TO THE CALLING PROGRAM. .T. WHICH WILL DO NOTHING. THIS ALLOWS THE DEVELOPER TO DESIGN A SKELETON MENU STRUCTURE PRIOR TO COMPLETING ALL OF THE SUBROUTINES. // CALL FT_MENU1 FT_MENU1( aBar, aOptions, aColors, 0 ) NOTE: FT_MENU1() disables Alt-C and Alt-D in order to make them available for the menu bar. It enables Alt-D and resets Alt-C to its previous state prior to calling each function. Source: MENU1.PRG Author: Paul Ferrara
See Also: FT_FILL()
FT_FILL
FT_FILL() Declare menu options for FT_MENU1() Syntax FT_FILL( <aSubArrayName>, <cMenuSelection>, <bFunction>, <lSelectable> ) -> NIL Arguments <aSubArrayName> is a sub-array of <acOptions> in FT_MENU1() denoting the group in which to include the selection -- e.g., acOptions[1] <cMenuSelection> is the character string that will appear on the menu. <bFunction> is the code block to be executed when that menu option is selected. i.e. {|| MyFunction() } would execute the function called MyFunction(). {|| .f.} would exit the FT_MENU1 and return to the calling routine. {|| .T.} would do nothing. <lSelectable> is a logical variable that determines whether the corresponding menu option is selectable or not. Returns NIL Description FT_FILL() is a function used to set up the menu options prior to calling FT_MENU1(). Examples FT_FILL( aOptions[1], 'A. Execute A Dummy Procedure', {|| fubar()}, .t. ) The above would be added to the sub-menu associated with the first menu bar item, would execute the function FUBAR() when that option was selected, and would be selectable. FT_FILL( aOptions[3], 'B. Enter Daily Charges', {|| .t.}, .f. ) The above would be added to the sub-menu associated with the third menu bar item, and would be unselectable. FT_FILL( aOptions[2], 'C. Enter Payments On Accounts', {|| .t.}, .t. ) The above would be added to the sub-menu associated with the second menu bar item, and would be selectable, but would do nothing when selected. FT_FILL( aOptions[4], 'C. Exit', {|| .f.}, .t. ) The above would be added to the sub-menu associated with the fourth menu bar item, and would be selectable, and would exit FT_MENU1() when chosen. Source: MENU1.PRG Author: Paul Ferrara
See Also: FT_MENU1()