Welcome to the TextField Version 2.0 Read-Me.  Enjoy your stay, mortal.  ;)
This class is pretty hefty, so much explaining is due.


First, you're probably wondering about the three turing files you downloaded.  
	-"TEXTFIELD.tu" is the class itself, from which you create your objects.  
	-"textfield procedures.t" includes some code that you will need to include in your main program if you wish to support tabbed browsing between textfields and it also prevents a problem where more than one textfield could be selected at one time.  It was necessary to place this code outside the class because the class only handles one textfield.  Creating multiple textfields requires the programmer (that's you!) to create an array of pointers to the textfield class.
	-"Ex Field.t" is a little bit of code to show off the textfield, and to provide you with the general idea of how best to structure your program to suit the textfields (mind you, the textfields will live fine however you code your program, so long as you call the 'INIT', 'getInput', and 'draw' procedures.  This isn't like Turing's rigid GUI!)


Second, you'll want to know what's good about using this class.  What are the features, and what are the drawbacks?

-=FEATURES=-
	- Selections:  Select a range of text by using the shift keys or by dragging a selection with the mouse
	- Fully functional input:  Use the ctrl keys to move word by word, use the home and end keys, use the mouse to select positions, drag with the mouse to select ranges, double click with the mouse to select words, and triple click with the mouse to select a range of everything in the textfield.
	- Error Proofed input: For example, If you want your textfield to get a real value, the textfield will automatically parse the input and prevent stupid inputs such as "1.4.78..2"
	- Easy Initializing: You can use the INIT_full procedure to totally customize the textfield (except for some things which can be changed manually with other procedures.  See the description of the INIT_full procedure below), or you can use the INIT procedure to quickly and easily create a predefined textfield.
	- Movement: Use the set_centre and set_coords procedures to move the textfield about the screen.
	- TABing: use the TAB button to scroll through textfields.  This requires calling the handle_behaviour procedure found in "textfield procedures.t"
	- Only one selection at a time: Easily prevent more than one textfield from being selected at a time.  Doing this requires calling the handle_behaviour procedure found in "textfield procedures.t"
	- A host of procedures and functions to easily interact with the textfield (checking for various conditions, for example).

-=DRAWBACKS=-
	- Clipping: If you use clipping in your main program, you'll have to reset the regions after drawing a textfield
	- The use of 'e': A textfield that is set to accept real values cannot use 'e' (as in 1.4e3).



Third, you'll need to know the basic functionings of the textfield.  In this section I will explain the methods.

INIT_full (x1, y1, x2, y2, width, height, xPadding, yPadding : int,                                   
            inputType, labelText, fontName : string, fontHeight,                                                
            clrMain, clrHighlight, clrSelect, clrLabel, clrSelection, clrBoarder : int) 

	This procedure is used to initialize a textfield object after it has been spawned from the fiery hellpit.  There are many parameters to this procedure, so make sure you get them right!  If you don't want to spar with so many parameters, you could simply use the INIT procedure (described below), which will create a mundane grey (but still decent looking) textfield.  
	xPadding and yPadding determine how far, in pixels, from the edges of the textfield the actual text will appear.  
	There are three aspects of the textfield that have been automatically chosen for you.  These are the maximum number of characters that can be inputted (set to 255), the output type (set to normal.  See some paragraphs ahead for an explanation of output type), and the behaviour of the text when the field is first selected (set to remain status quo when clicked).  These aspects can be changed by calling the set_maxLength, set_outputType, and set_blankWhenClicked procedures, respectively.
	There are two ways to set the location of the textfield.  The first way is to input values for x1, y1, x2, and y2.  This will work just like you're drawing a box with Draw.Box.  The second way is to input values for x1 and y1, which will be treated as the centre of the box.  Input zero (0) for x2 and y2, then input some values for width and height.  Note that width and height are measurements of the entire width and height, respectively, not from the centre to one edge.
	One final note: if a value less than or equal to zero (0) is inputted for the fontHeight parameter, the font height will be automatically calculated to fit the height of the textfield.



INIT (x, y, width, height : int, labelText : string)
	
	This procedure will use the second method for choosing the location and will create a grey textfield (based on centre and width & height).  The font will be automatically assumed to be Times New Roman, and the font height will be automatically calculated to fit the height of the field.



proc set_blankWhenClicked (b : boolean)

	This procedure allows the programmer (you) to choose whether the textfield will lose all it's text when it is first clicked, allowing for easy input.  This is good if you want to totally redo something, but not so good if you want to edit a value.



proc set_maxLength (maxLength : int)

	This procedure sets the maximum number of characters the user can input into the textfield.  The maximum maximum number of characters is 255.



proc set_outputType (key : string)

	This procedure sets the output type.  Normal output is achieved if key = "".  Changing the output type is useful for creating password fields, as demonstrated in the example.  If there is a certain output type, every character that is inputted will be drawn as that ceratin output character.



proc set_inputType (type_ : string)

	This procedure sets the input type.  The standard is a string, which allows standard character to be inputted.  Other types include "int", "real", "letters", "words" ("words" is the same as letters except hyphens (-) and spaces ( ) can also be inputted), and "sentance" (same as "words" except punctuation is allowed).
	One nice aspect of the input type is that it will automatically error proof input for you.  For example, if you are looking to get a real value, the textfield will prevent inputs such as "1.4.5" and "102..23"


fcn is_changed : boolean

	This function returns true if the textfield has been changed.



fcn is_inputConfirmed : boolean

	This function returns true if enter was just pressed, confirming the input.



proc resetToOriginal

	This procedure will reset the text in the textfield to what it originally was.  (Note that the original text can be changed by using the set_initText procedure.)



proc set_visible (b : boolean)

	This procedure allows the programmer (you) to set the visibility of the textfield.  If true, the textfield is visible.  If false, the textfield is invisible (not drawn) and cannot accept input.


fcn is_visible : boolean

	This function returns the boolean value of the visibility of the textfield (true = showing, false = hidden).  It is often useful to check if a textfield is visible or not as a check of what the user is doing in the program.  
	For example, say we only want to show the "Enter Password" field once the "Enter Username" field has been inputConfirmed.  We use the set_visible procedure to set the visibility of the "Enter Password" field to true after we get an inputConfirm from the "Enter Username" field.  Also inside the main loop, we check if the "Enter Password" field is visible, using this function.  If it is, we show a button to log in.  This button could even have many different functions, depending on which textfields are visible (it could be a log in button, or a confirmation button, for example).


proc set_initText (s : string)

	This procedure sets the original text to the value of 's' (the parameter).  This will not change the current text, and will only affect things when you call resetToOriginal, or check things using is_inputConfirmed.


proc set_centre (centreX, centreY : int)

	This procedure moves the textfield to have a centre located at (centreX, centreY).  This will not change the width or height of the field.



proc set_coords (x1, y1, x2, y2 : int)

	This procedure moves the corners of the textfield as should be self-evident.



proc set_font (fontName : string)
	
	This procedure changes the font of the textfield.  This will not change the size of the font.  Use the following procedure (perhaps in conjunction with this one) for more customization.



proc set_fontHeight (fontName : string)
	
	This procedure changes the height of the font in the textfield.  This will not change the font itself (eg. Times New Roman or Arial).  Use the preceding procedure (perhaps in conjunction with this one) for more customization.


fcn output : string

	This function returns the entire text within the textfield.  Note that even if you are using an output type, the real text will be returned.


proc getInput

	This procedure handles all the input you need (except for tabs!).  Calling this procedure is a must, unless you want your textfield to simply act like a label.


proc draw

	This procedure draws the textfield and everything within it (text, selections, etc.).  Note that it uses clipping regions, so if you use them yourself, you'll have to reset them after drawing the textfields.


proc FREE

	This procedure frees all objects allocated by the textfield.  Currently, that means freeing the font used by the textfield, though later version could involve pictures that need to be freed as well.  Note that this procedure does not free the instance of the class.  You'll need to follow up calling this procedure with something like:
	free TEXTFIELD, variable_that_points_to_TEXTFIELD



And that's that.  I hope you'll find this textfield powerful, versatile, and useful.  

-Cervantes