*ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»* *º Description: There are different ways to create a GET. Here are just º* *º three that will create the same GET. º* *º Author.....: Micheal Todd Charron º* *º Notes......: Hope it Helps. º* *º º* *º Copyright..: (c) The people at Nantucket Canada, 1991 º* *ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ* ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß * FIRST EXAMPLE *************************************************************** FUNCTION Main() LOCAL cVar := SPACE( 30 ) @12, 30 GET cVar PICTURE '@!' VALID ( ! EMPTY( cVar ) ) READ RETURN Nil ******************************************************************************* ÕÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͸ ³ @12, 30 GET cVar PICTURE '@!' VALID ( ! EMPTY( cVar ) ) ³ ÔÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ; Nothing special about the above GET. The above GET could be compiled in SUMMER '87 with no modification. In fact, with the VALID clause stripped off, it could be used in any dBase dialect. At row 12, column 30 (@12, 30) the variable cVar will be edited with all the letters changed to upper case. The VALID clause will not let the user finish the GET if the editing buffer is empty. ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ ------------------------------------------------------------------------------- ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß * SECOND EXAMPLE ************************************************************** FUNCTION Main() LOCAL cVar := SPACE( 30 ) LOCAL oGet oGet := GETNEW( 12, 30, { | x | IF( x == Nil, cVar, cVar := x ) },; 'cVar', '@!' ) oGet:POSTBLOCK := { || ! EMPTY( cVar ) } READMODAL( { oGet } ) RETURN Nil ******************************************************************************* This is the object oriented way of creating a GET. The variable "oGet" will contain the reference to the object created by the function GETNEW(). ÕÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͸ ³ oGet := GETNEW( 12, 30, { | x | IF( x == Nil, cVar, cVar := x ) },; ³ ³ 'cVar', '@!' ) ³ ÔÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ; GETNEW() will create an object that will contain the characteristics of this particular GET. The first and second parameters of the GETNEW() function are (respectively) the row and column of this GET. The third parameter is the code block which will handle the display of the value in the GET. The fourth parameter is the name of the variable and the fifth parameter is the picture string which controls the display and editing of the GET. All of these parameters are stored inside of the GET object and will be used in the READMODAL() function. ÕÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͸ ³ oGet:POSTBLOCK := { || ! EMPTY( cVar ) } ³ ÔÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ; This line essentially creates the VALID clause for the GET object. After the GET is exited this block will be evaluated (hence the POST in POSTBLOCK). ÕÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͸ ³ READMODAL( { oGet } ) ³ ÔÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ; This line passes the GET object into the READMODAL() function. The READMODAL() function contains all the routines for editing this GET. If you are feeling adventurous look at the READMODAL() function in GETSYS.PRG which should be located in the /SOURCE/SYS subdirectory in you CLIPPER directory. The reason the curly braces enclose the GET object is that the READMODAL() function uses arrays to move through the different GET objects. With the curly braces we create a literal array with that one GET object contained in it. The first GET example actually does something similar in that it creates the GET object and then stores it in an array called 'GETLIST'. When you issue the READ command it calls the READMODAL() function and passes the 'GETLIST' array into the READMODAL() function. ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ ------------------------------------------------------------------------------- ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß * THIRD EXAMPLE *************************************************************** FUNCTION Main() LOCAL cVar := SPACE( 30 ) LOCAL oGet oGet := GETNEW() oGet:ROW := 12 oGet:COL := 30 oGet:BLOCK := { | x | IF( x == Nil, cVar, cVar := x ) } oGet:NAME := 'cVar' oGet:PICTURE := '@!' oGet:POSTBLOCK := { || ! EMPTY( cVar ) } READMODAL( { oGet } ) RETURN Nil ******************************************************************************* ÕÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͸ ³ oGet := GETNEW() ³ ÔÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ; The GETNEW() function without any parameters will create a GET object with very little stored inside of it. The characteristics of the GET must be added after this line. ÕÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͸ ³ oGet:ROW := 12 ³ ³ oGet:COL := 30 ³ ÔÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ; Stores the row and column locations inside of the GET object. ÕÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͸ ³ oGet:BLOCK := { | x | IF( x == Nil, cVar, cVar := x ) } ³ ÔÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ; Stores the code block which is responsible for retrieving a value for the GET that is on the screen and assigning the new edited value to the GET's variable. When the GET receives input focus (the mode which makes the GET ready for editing methods) it will evaluate this code block and display the current value of the GET's variable. When displaying the GET, no parameters will be passed to the code block therefore the variable 'x' will have a value of NIL. ÕÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͸ ³ oGet:NAME := 'cVar' ³ ÔÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ; This line stores the name of the GET's variable into the object. This is optional and really is only needed in order for the READVAR() function to work while using the READMODAL() function. It is a nice way to document a GET object and can assist you in finding a GET object logically rather that physically. ÕÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͸ ³ oGet:PICTURE := '@!' ³ ÔÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ; This line stores the picture string for formating and editing of the GET. ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ ------------------------------------------------------------------------------- Either of these three methods will give the same result. The fact is that you should use the method that makes you most comfortable but I will tell you that by using the second or third examples you will find that you have more flexibility in what you can do with GETs in CLIPPER 5.0/5.01. Try out the GET class, you'll see that it really isn't as difficult as it looks. ------------------------------------------------------------------------------- ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß The only difference between the first example and the second and third examples is that the old way of creating a get will automatically display the GET on the screen whereas the second and third examples will not display until you use the READMODAL() function. This is because of compatibility for those who displayed variables in the GET color without actually editing those GETs. In the second and third examples you can do this by issuing the DISPLAY() method rather than using the READMODAL() function.