[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
##############################################################################
###+------+###################################################################
#+-| FILL |-----------------------------------------------------------+#######
#| +------+ Draws a box, optionally fills box, optionally shadows box |#######
#+--------------------------------------------------------------------+#######
##############################################################################
##############################################################################
#+--| Summary |----------------+##############################################
#| #INCLUDE string.hdr |##############################################
#+-----------------------------+##############################################
##############################################################################
##############################################################################
#+--| Syntax |------------------------------+#################################
#| PROCEDURE fill PROTOTYPE |#################################
#| PARAMETERS VALUE INT upper_row,; |#################################
#| VALUE INT upper_col,; |#################################
#| VALUE INT lower row,; |#################################
#| VALUE INT lower_col,; |#################################
#| CONST CHAR border,; |#################################
#| CONST CHAR fill_chars,; |#################################
#| VALUE INT border_color,; |#################################
#| VALUE INT fill_color,; |#################################
#| VALUE INT shadow_value |#################################
#+------------------------------------------+#################################
##############################################################################
##############################################################################
##########+---| Description |---------------------------------------+#########
##########| This function accomplishes the following: |#########
##########| |#########
##########| * draws a box on the screen using user-defined |#########
##########| border characters. |#########
##########| * optionally fills the box with a character string. |#########
##########| |#########
##########| * optionally shadows the box. |#########
##########| |#########
##########| The first four parameters, upper_row, upper_col, |#########
##########| lower_row, lower_col, define the screen coordinates for |#########
##########| the box. |#########
##########| ------------------------------------------------------- |#########
##########| The border parameter is an 8 byte character string |#########
##########| defining the border characters. fill reads the 8 byte |#########
##########| string from left to right using each character to |#########
##########| define a corner or side of the box. Character strings |#########
##########| that create boxes using the double or single box |#########
##########| characters are already defined in string.hdr |#########
##########| ------------------------------------------------------- |#########
##########| fill_chars parameter specifies a character string to |#########
##########| fill the inside of the box. If fill_chars is a NULL |#########
##########| string, then the box is not filled. If fill_chars is |#########
##########| a multi-character string, then fill starts at the 1st |#########
##########| character of the string and rotates through the string |#########
##########| as it fills the box. This enables programming of a |#########
##########| screen that should be filled with a company name. |#########
##########| ------------------------------------------------------- |#########
##########| border_color specifies the color attribute for the |#########
##########| border of the box while fill_color specifies the color |#########
##########| attribute for the fill character string, fill_chars. |#########
##########| see colors.hdr for color defines. |#########
##########| ------------------------------------------------------- |#########
##########| shadow_value allows the box to be shadowed on any one |#########
##########| or all sides. The shadowing effect is generated by |#########
##########| either removing the highlight bit of the color |#########
##########| attribute or making the color attribute black. |#########
##########| ------------------------------------------------------- |#########
##########| Each side of a box is assigned a number, starting from |#########
##########| the top side which is assigned number 1. The right |#########
##########| side of the box is side 2, the bottom is side 3 and the |#########
##########| left side is side 4. shadow_value is interpreted by |#########
##########| fill as 4 binary bits, with each bit indicating whether |#########
##########| a side is to be shadowed. If the bit is ON, the side |#########
##########| is shadowed. |#########
##########| ------------------------------------------------------- |#########
##########| For example, to shadow the top and the left side of a |#########
##########| box, set shadow_value to 4, which is binary 0011. |#########
##########| SHADOW TABLE indicates which binary and decimal values |#########
##########| are required to shadow a particular side. |#########
##########+---------------------------------------------------------+#########
##############################################################################
##############################################################################
#########+--| Example 1 |-------------------------------------------+#########
#########| * Draw a box on screen using the "*" and "-" |#########
#########| * characters for the border. |#########
#########| |#########
#########| fill( 4,4,10,40,"*-*-*-*-"," ",7,7,0 ) |#########
#########+----------------------------------------------------------+#########
##############################################################################
##############################################################################
#########+--| Example 2 |-------------------------------------------+#########
#########| * Draw a box on screen using the double box and have |#########
#########| * the right and bottom sides of the box be shadowed. |#########
#########| |#########
#########| #include string.hdr |#########
#########| |#########
#########| {...} |#########
#########| |#########
#########| fill( r,c,r1,c1,&DOUBLE_BOX, "Ted's T.V.", ; |#########
#########| &BLUE_GREEN, &BLUE_GREEN, 6 ) |#########
#########+----------------------------------------------------------+#########
##############################################################################
##############################################################################
#########+--| Example 3 |-------------------------------------------+#########
#########| * Use savescrn() to save a portion of a screen |#########
#########| * prior to drawing a box. |#########
#########| |#########
#########| qscrn = savescrn( 20,2,23,76 ) |#########
#########| fill( 20,2,23,76," "," ",&CYAN_WHITE, ; |#########
#########| &CYAN_WHITE, 0 ) |#########
#########+----------------------------------------------------------+#########
##############################################################################
##############################################################################
#########+--| Example 4 |-------------------------------------------+#########
#########| * An error procedure that prints a message in the |#########
#########| * middle of the screen. The function figures out |#########
#########| * the size of the box required for the message. |#########
#########| |#########
#########| #include colors.hdr |#########
#########| #include data.hdr |#########
#########| #include string.hdr |#########
#########| |#########
#########| #define ERROR_MSG "Press any key to continue." |#########
#########| |#########
#########| PROCEDURE yell |#########
#########| PARAMETERS CONST CHAR error_str |#########
#########| VARDEF |#########
#########| INT k,s,c,n,z,q |#########
#########| ENDDEF |#########
#########| |#########
#########| sound( 150, 2 ) |#########
#########| z = len( error_str ) |#########
#########| IF z < len( &ERROR_MSG ) |#########
#########| z = len( &ERROR_MSG ) |#########
#########| ENDIF |#########
#########| |#########
#########| q = z + 5 |#########
#########| n = 40 - (z /2) - 2 |#########
#########| s = savescrn( 11,n,15,n+q ) |#########
#########| |#########
#########| fill( 11,n,15,n+q,&SINGLE_BOX," ", &RED_WHITE, ; |#########
#########| &RED_WHITE, 6 ) |#########
#########| |#########
#########| c = __color_std |#########
#########| __color_std = &RED_YELLOW |#########
#########| |#########
#########| @ 12,40-(z/2) ?? error_str |#########
#########| @ 13,40-(len(&ERROR_MSG)/2) ?? &ERROR_MSG |#########
#########| |#########
#########| k = get_key() |#########
#########| __color_std = c |#########
#########| restorescrn( s ) |#########
#########| |#########
#########| ENDPRO |#########
#########+----------------------------------------------------------+#########
##############################################################################
See Also:
restore_area
restorescrn
save_area
savescrn()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson