Changes

Jump to: navigation, search

BIOF 20101 (AS1) - OOP344

237 bytes added, 19:43, 26 January 2010
m
Line Editor: int bio_edit(........)
Outputs the null-terminated string pointed to by "str", on the screen starting at row "row" and column "col", upto "len" characters. As with bio_move(), 0 is the top row, and 0 is the leftmost column. If the string is longer than "len", then only "len" characters are displayed, but if it is shorter than "len", then the entire string is displayed left-justified in the field. However, if "len" is 0 or less, then the field length is considered to be the actual length of the string (i.e. the entire string is displayed). Afterwards, the cursor is positioned after the last character of the field. (Note that on systems where output is buffered, this function should not flush the output buffer). The results are undefined if the specified values indicate a field that does not fit on the screen.
 
 
=== Line Editor: int bio_edit(........) ===
NOTE: Following corrections should be done to '''"*curpos"''' and '''"*offset"''' in case they hold invalid values before editing begins:
# Set If '''"*curpos"''' exceeds the value of fieldlen, correct the '''"*curpos"''' so that cursor stands at the last position of inside the field if it exceeds fieldlen.# If '''"*offset"''' is greater than the length of the string, set the '''"*offset"''' so the “last character of str” is hidden right before the first space in the field. (See[[OOP344 Assignment OneBIO 20101#IsTextEditor:|IsTextEditor]] for more)# After the above, if cursor is past the last character of '''“str”''' set '''"*curpos"''' so the cursor stands right after the last character of "str".
The cursor is never allowed to : 1- move before the start of the field, 2- more than one position past the last character in the string, or 3- after the end of the field.
<u>Editing is terminated by pressing ENTER, TAB, UP, DOWN, PGUP, PGDN or any of the function keys (F1 to F12)</u>. Pressing <u>ESCAPE will terminate the bio_edit(), and abort editing</u>; '''"str"'''will contain orinally passed data when leaving function.
* HOME – move cursor to the beginning of the string. Scroll all the way to right if necessary. (i.e. if there is hidden data at the beginning)
* END - go to the end of the data in the string, i.e. just past the last character in the string. Scroll all the way to left if necessary.
* INSERT - toggle Insert/Overstrike mode<br />In Insert mode, printable characters are inserted into the string, moving the remainder of the string to the right to make room. In Overstrike mode, printable characters overwrite existing characters (if any). Note that if you are past the end of the string, printable characters are appended to the string (as long as the string isn't full) regardless of the mode. Also note that, regardless of the mode, the cursor advances as printable characters are typed into the string. Finally, if the cursor is at the end of the field, instead of moving to right, the characters are shifted to left.
* DEL – eat the current character above the cursor and move all subsequent characters one position to the left.
* BACKSPACE - move the rest of the field (including the cursor) one position to the left, eating the previous character.
** if '''IsTextEditor''' is false, TAB will simply terminate the function like a Function key
** if '''IsTextEditor''' is true, TAB will insert CIO_TAB_SIZE number of spaces into the string.'''CIO_TAB_SIZE''' should be a defined "tab size" value in ciol.h. If'''CIO_TAB_SIZE''' spaces cannot be inserted into the string for any reason then the inputted tab should be ignored. (See below for more about '''IsTextEditor''' flag)
* ESCAPE - Terminates the bio_edit(), and abort editing; '''"str"'''will contain originally passed data when leaving function. (See[[OOP344 BIO 20101#IsTextEditor:|IsTextEditor]] for exception)
* INSERT - toggle Insert/Overstrike mode<br />In Insert mode, printable characters are inserted into the string, moving the remainder of the string to the right to make room. In Overstrike mode, printable characters overwrite existing characters (if any). Note that if you are past the end of the string, printable characters are appended to the string (as long as the string isn't full) regardless of the mode. Also note that, regardless of the mode, the cursor advances as printable characters are typed into the string. Finally, if the cursor is at the end of the field, instead of moving to right, the characters are shifted to left.
==== IsTextEditor: ====

Navigation menu