<> <<uicode>> * This file contains the basic text display functions, written to generate * clipper code using the BREEZE library. Note that it is up to the * application template to control window selection. These routines write * to the current window only. * display_text: replaces the ui1 label {display text}. called as: * <<display_text>> or * <<display_text()>> or * <<do display_text>> * (as always, in a <<uicode>>/<<enduicode>> block the angle brackets should * be omitted) * function display_text draw_no_outline_box( screen, screen.color ) for all boxes where box.popup = .f. display_box( box ) endfor for all options where option.popup = .f. display_option_unselected( option ) endfor return * display_box: replaces the ui1 label {display box}. called as: * <<display_box(boxvar)>> or * <<do display_box with boxvar>> * function display_box param b if b.outline.type draw_outline_box( b, b.outline.color, b.contents.color ) else draw_no_outline_box( b, b.contents.color ) endif return ************************** display_option, etc ********************* function display_option_unselected param o if o.outline.type draw_outline_box( o, o.outline.color.unsel, o.contents.color.unsel ) else draw_no_outline_box( o, o.contents.color.unsel ) endif return function display_option_selected param o if o.outline.type draw_outline_box( o, o.outline.color.sel, o.contents.color.sel ) else draw_no_outline_box( o, o.contents.color.sel ) endif return * same as display_option_unselected function display_option param o display_option_unselected( o ) return ************ internal functions ************* * draw_outline_box: writes display code for box with outline * function draw_outline_box param b, olcolor, ctcolor private flag, frm_type, i, line, tmp, xline * Get outline string for box command. Check the first character of the * outline.string (the upper left corner). Try to find the corresponding * BREEZE frame type. If nonstandard, use type 1 (single line). frm_type = at( substr( b.outline.string, 1, 1 ), 'ÚÉÕÖ+' ) if frm_type = 0 frm_type = 1 endif * Clear the interior w/ the interior color. ? "wclear( 1, 1, wrow() - 2, wcolumn() - 2, '{ctcolor}' )" * Set the outline color and frame the window. ? "wcolor( '{olcolor}' )" ? "wframe( {frm_type} )" * Set the interior color. ? "wcolor( '{ctcolor}' )" * Write the code to output text from box interior. Do not allow overwrites * on vertical portion of frame (BREEZE won't do it anyways). for i = 1 to b.height - 2 line = box_text( b, i, 1, b.width - 2 ) xline = trim( line ) if len( xline ) ? "wprint( {i}, {(at( xline[ 1 ], line ))}, '{xline}' )" endif endfor * Just in case the frame bottom has text in it, redisplay it. flag = 0 ** Increment if we do anything with the frame. line = box_text( b, b.height - 1, 1, b.width - 2 ) xline = substr( line, 1, 1 ) tmp = len( line ) - 1 for i = 2 to tmp if xline != substr( line, i, 1 ) flag = flag + 1 exit endif endfor if flag ? "wcolor( '{olcolor}' )" ? "wprint( {(b.height - 1)}, 1, '{line}' )" endif * Now check to see if we need to put text in the top of the box. The text * is in slot 2. if len( b.slot2 ) flag = flag + 1 line = rtrim( b.slot2 ) if substr( line, 1, 1 ) = ' ' line = line + ' ' endif if flag = 1 ** I'm a minimalist. If color already set above then don't redo. ? "wcolor( {otcolor} )" ** (flag is 2 if done above). endif ? "wprint( 0, 2, '{line}' )" endif * If we needed to display more frame stuff, reset to the interior color. if flag ? "wcolor( '{ctcolor}' )" endif return * draw_no_outline_box: display code for no outline box * function draw_no_outline_box param b, color * set to interior color & clear ? "wclear( 0, 0, wrow() - 1, wcolumn() - 1, '{color}' )" * write the text (note space trimming) for i = 0 to b.height - 1 line = box_text( b, i, 0 ) xline = trim( line ) if len( xline ) ? "wprint( {i}, {(at( xline[ 1 ], line ) - 1)}, '{xline}' )" endif endfor return <<enduicode>>