 EditNew.pas

 Comment in English y en Espaol.

 English
 -------------------------------------------------------------------------------
 - Author   : Jose Maria Gias        Zaragoza - Spain
 - email    : sigekom@arrakis.es
 - Home     : http://www.arrakis.es/~sigecom

 - Version  : 2.4	Delphi 2,3,4
 - Date     : 08/04/1999
 - Type     : FreeWare

 - Package of 3 Components TEdit, TMaskEdit and TDBEDIT, that try to integrate
   many of the actions that customarily are accomplished in the applications
   upon using the components standard TEdit, and adds the following properties:

   Properties:

   ColorOnFocus    - Back Color when the Edit has the focus

   ColorOnNotFocus - Back Color when the Edit Does not has the focus

   FontColorOnFocus - Back font color when the Edit has the focus

   FontColorOnNotFocus - Back font Color when the Edit Does not has the focus

   FontColorOnOverWrite - Back font Color when the Insert key is in overwrite mode

   KeyByTab        - Response upon pulsateing a key as if is pulsateed Tabulator
                     to leave of the component happening the focus to the
                     following, with the value of other key.

                     For defect is assigned the standar of Windows Tabulator for
                     to annul it: KeyByTab = #9

                     For example, if we wish that of a TEditN could be happened
                     the focus to the following object with the Return key, in
                     addition to with the Tabulator, we would put this value to
                     KeyByTab = #13

   WidthOnFocus    - Permits to define a width of the different EditN when the
                     EditN has the Focus. The width is not adjusted in function
                     of the introduced text, being had to be defined in design
                     mode.

   TextHint        - If it is true, a Hint shows with the content of the Edit 
                     when the longitude of the text surpasses the one that is 
                     visualized in the Edit

 - The TEditN and TDBEditN includes furthermore the following properties:

   FirstCharUpper  - Converts to Uppers the first char of the string if
                     EditType = etString

   FirstCharupList - Converts to capital letters any character located behind
                     the characters written in this property, as long as
                     FirstCharUpper it will be True

 - The TEditN includes furthermore the following properties and methods:

   EditType        - etString, etInteger, etFloat, etDate, etTime. Consideration
                     of the data that it will contain the Edit

                     etDate. Permit to introduce manually part of the date and
                     the Edit end of completing it

                     etTime. Permit to introduce part of a time and the Edit
                     end of completing it

   EditAlign       - etAlignRight, etAlignLeft, etAlignCenter, etAlignNone.

                     Align the string, with respect to the indicated length
                     in EditLengthAlign, when EditType = etString

                     etAlignValue. If EditType = etInteger or etFLoat, fills with 0
                     the spaces to the left of the String until completing the
                     quantity of characters indicated in EditLengthAlign.
                     Observe the negative sign if it has been introduced, and
                     the separating decimal counting as a char more of the string.

   EditLengthAlign - Length of the string when it is aligned. Have into account
                     when EditAlign <> etAlignNone, and is fulfilled indicated
                     what is for EditAlign

   ValueInteger    - Integer Value of the Edit, when EditType = etInteger
                     If is produced a conversion mistake would return 0

   ValueFloat       - FloatValue of the Edit, when EditType = etFloat
                     If is produced a conversion mistake would return 0

   ValueDate       - Value TDateTime when the Edit is etDate. In this case, in
                     ValueInteger and ValueFloat, it is returned the value Integer 
                     or Double of the date

   ValueTime       - Value TDateTime when the Edit is etTime. In ValueFloat 
                     returns the value Double of Time

   EditPrecision   - Permits to define the quantity of decimal. If the value is
                     greater than 0, format the value, completing with zeroes to
                     the end if there is no decimal introduced.

                     ## In the case of be value Float, the separating decimal it
                     catch by defect of Windows.

   TimeSeconds     - Is added the property TimeSeconds, to indicate that when
                     the Edit is etTime, it fills the seconds. All the varying 
                     of time are completed with 00

  Methods:

   SetInteger      - Procedure, by the one which can allot directly a value
                     Integer to the EditN, when it is defined as etInteger
                     Example:   EditN10.SetInteger(63565);

   SetFloat        - Procedure, by the one which can allot directly a value
                     Float to the EditN, when it is defined as etFloat.
                     Example:   EditN9.SetFloat(- 63,56);

   SetPtrToData    - Assigns the EditN to a variable, so that when  change the 
                     value of the Edit, will change automatically that of the 
                     variable, and to the contrary, by middle of the procedure 
                     Update

   Update          - Updates the value of the EditN with that of the assigned 
                     variable. To see the demo for demonstration of as can be 
                     created in RunTime arrays of EditN and to assign them in 
                     a way dynamic to Arrays of values Integer, Float or String
                     in function of the value of an index, what permits be 
                     displaced on a array with an alone block of EditN.

 ###############################################################################

 Version 1.01

  - Include controls to avoid that is generated exception upon converting a
    value integer, when it exceeds of the maximum ranges of said type.

    In this case, it notifies of the fact that it has been exceeded of the
    range, and lets ValueInteger = 0

  - Include control so that when it is a value Float could not be introduced
    but of 20 digits

 ###############################################################################

 Version 1.02

  - Amends an existing Bug when the EditType = etString or etFloat, and is loaded
    directly a value on the EditNew, so that ValueInteger and ValueFloat they
    are not updated. Part of the procedure DoExit has been separated to Change.

  - Is added a control to eliminate the characters not permitted, before
    to convert to Integer or Float.

  - Change control so that when it is a value Float could not be introduced
    but of 16 digits. Now ValueFloat is Double, before is Extended.

  - Is added the property WidthOnFocus for power to configure a Width of the Edit
   when this has the Focus. It is valid when its value is greater than 0

 -------------------------------------------------------------------------------
 ## The following properti are introduced by Raymond Kleefstra:

 - Raymond Kleefstra
 - mail: rkleefstra@tip.nl
 - URL:  http://stad.dsl.nl/~malloc

  TextAtEnter     - Memories the exact text as it was when the field is entered.
                    Is used to cancel changed when ESC is pressed

 ###############################################################################

 Version 1.03   12/07/1997

 - Is amended an Bug of the prior version, by the one which the property MaxLength
   it is put automatically with value 10.

 - Is amended a Bug that was happening in manner designer, when defining
   etInteger or etFloat and to enter to erase the value of Text, gave a Range
   error

 - Is included in the refunding of FirstCharUpper in the proceeding OnExit, for
   the case of the fact that is traded to the first position during the edition.

 - Is traded the decision of the events OnKeyPress, OnEnter, OnExit, OnChange
   to the public part for power to use them thereinafter

 - Is included the option of introducing directly a value Integer or Float
   according to this the property EditType, with the proceeding SetInteger or
   SetFloat respectively. To see the demo for its operation

 ###############################################################################

 Version 2.0   05/17/1998

 04/28/98 Addition by Andrea Sessa   asessa@nest.it

          FontColorOnFocus    - Back font color when the Edit has the focus

          FontColorOnNotFocus - Back font Color when the Edit Does not has the focus

 05/14/98 Addition by idea of Marcio William liftbr@ibm.net

          - Are updated always ValueInteger and Appraise Float when the Edit is
            <> of etString

          - Are assembled in the file EditNew.Pas the components:
            - EditNew      - TEditN
            - MaskEditNew  - TMEDITN
            - DBEDITNEW    - TDbEditN

 05/15/98 Addition by Raymond Kleefstra  rkleefstra@tip.nl

          - Connection procedures of the value of the Edit in function of its type
            etInteger, etFloat, etString, etDate, etTime to a variable or position 
            of a array of the same type.

          - SetPtrToData - Assigns the Edit to a variable, so that when change the 
                           value of the Edit, will change automatically that of the
                           variable, and to the contrary by middle of the procedure 
                           Update

          - Update - Updates the value of the Edit with that of the assigned variable

 05/16/1998 Addition by the author

            - In the demo is shown as creating arrays of TEditN in runtime in a
              form, and to assign it directly to a array of integer, according to
              the connection that establishes the index iIndex, as well as the form of
              it be displaced with the array of TEdit on the array of integer.

              In function of the type of the TEditN, it should be connected to a array 
              of the same type, for example, if the TEditN is etFloat, the array will 
              be float (Double) and will be tried without no type to conversion. 
              To see the example for the case of Integer.

              If type is etString, in principle must be ShortString variable

 ###############################################################################

 Version 2.1   05/26/1998

 05/24/1998 Addition by the author

            - Is modified the code as a rule, and are let commentaries only
              in English, optimizing it in part to make but understandable the
              same. They are implemented the mentioned ideas below,
              varying the code with respect to suggest by the authors.

 05/25/1998 For idea of Jos M Torrecilla    Zaragoza - Spain

            - Are added the types etDate and etTime, guided to the users that
              prefer to introduce manually the date or the hour, and the
              component is entrusted with completing it. For example:

                If for a date is not indicated nothing, by defect catchs the current.

                If is indicated 4, understands that it is gave it 04 of the month 
                and current year.

                If is indicated 0510, is completed to 05/10/1998. If is indicated 230695
                will understand that it is 23/06/1995, since catchs the current century by
                defect.

                If is wanted to indicate a date of the century 21, being in the century
                20, it is necessary to indicate the complete date (When we are in the
                century 21 no longer it will be necessary) 17012000 : 17/01/2000
                
              In any case, serves to indicate the date without separating, already
              that the Edit will put by defect specified it in the configuration
              regional of Windows, or to indicate the hour with the separating
              specified in such configuration.

              In the case of be etDate, returns in the event OnExit the value
              Integer and Double of the date indicated in ValueInteger and ValueFloat,
              and if it has been defined the pointer to other variable, will be updated
              also. If it is etTime, in ValueFloat returns the value Double of
              Time.

            - Is added the property TimeSeconds, to indicate if when the Edit
              it is etTime, it will fill or not the seconds. All the variants of
              time are completed with 00

 05/26/1998 - By idea of Oscar Felis    oscar@callcentereurope.dk

            - Is added the property FirstCharUpList that causes that convert to 
              capital letters any letter that is written after of any character 
              indicated in the property, always that FirstChartUpper it will be 
              True. For defect is  ' ('  .Por example:

               If we departed of the characters by defect, will be converted to
               capital letters any letter introduced after a character of
               space or of bracket.

 ###############################################################################

 Version 2.2   12/26/1998

	       Adapted to Delphi 4

 ###############################################################################

 Version 2.3   02/21/1999

               New Key "Insert" control Add for Jos R. Caamao
               and property FontColorOnOverWrite Add for autor

 ###############################################################################

 Version 2.4   08/04/1999

             - From Alexandre Guillien. email: AGuillien@csi.com

               New TextHint property if it is true, a Hint shows with the content 
               of the Edit when the longitude of the text surpasses the one that 
               is visualized in the Edit

             - Correction of a bug, for the one which when the type of the edit 
               is integer or float and the value is negative, it didn't allow to 
               introduce new negative values without erasing the previous one 
               before

             - From Daniel Inda
               email: regtecmatriz@regtec.com.br               

               To visualize in the edit the alignment to the right and centered 
               during the edition
               

 ###############################################################################

 To be Freeware, they are not offered guarantees of no class neither are admitted
 claims of no type.

 This component can be used, be distributed and be modified freely for use
 particular or didactic, but not for commercial use. For commercial use be put
 in touch with the author.

 This component can be put on the page WEB that is wished, be redistributed
 with an application freely, or be included in any book, CDROM or any other
 middle, as long as is included 100% of the content of the component.

 It will be thanked the one which any commentary, alteration or improvement
 introduced in the component is transmitted to the author.

 -------------------------------------------------------------------------------
 Espaol
 -------------------------------------------------------------------------------
 - Autor     : Jose Maria Gias            Zaragoza - Espaa
 - email     : sigekom@arrakis.es
 - Home      : http://www.arrakis.es/~sigecom

 - Versin   : 2.4         Delphi 2,3,4
 - Fecha     : 04.08.1999
 - Tipo      : FreeWare

 - Paquete de 3 Componentes TEditN, TMEditN (TMaskEdit) y TDBEditN ampliados, que 
   tratan de integrar muchas de las acciones que habitualmente se realizan en las
   aplicaciones al utilizar los componentes TEdit estndar, y aade las siguientes
   propiedades:

   ColorOnFocus    - Color de fondo cuando el Edit tiene el Foco

   ColorOnNotFocus - Color de fondo cuando el Edit No tiene el Foco

   FontColorOnFocus - Cambia el color de la fuente cuando el Edit
                     tiene el foco

   FontColorOnNotFocus - Cambia el color de la fuente cuando el edit
                     pierde el foco

   FontColorOnOverWrite - Cambia el color de la fuente cuando la tecla Insert
                     esta en modo de sobreescribir

   KeyByTab        - Respuesta al pulsar una tecla, como si se pulsara Tabulador
                     para salir del componente, pasando el foco al siguiente, con
                     el valor de otra tecla.

                     Por defecto se asigna el estandar de Windows: Tabulador, para
                     anularlo: KeyByTab = #9

                     Por ejemplo, si deseamos que de un TEditN se pueda pasar el
                     foco al siguiente objeto con la tecla Enter ademas de con
                     el Tabulador, pondriamos esta valor a KeyByTab = #13

   WidthOnFocus    - Permite definir una anchura del TEditN diferente cuando el
                     EditN tiene el Foco. La anchura no se ajusta en funcin del
                     texto introducido, debiendose definirse en modo diseo.

   TextHint        - Si vale true, muestra un Hint con el contenido del Edit, 
                     cuando la longitud del texto del mismo sobrepasa la que se 
                     visualiza en el Edit

- El TEditN y TDBEditN incluyen tambin las siguientes propiedades:

   FirstCharUpper  - Convierte a mayusculas el primer Caracter de la cadena si
                     EditType = etString, en el evento OnExit

   FirstCharupList - Convierte a maysculas cualquier caracter situado detras de
                     los caracteres escritos en esta propiedad, siempre que
                     FirstCharUpper sea True. Por defecto : ' ('

- El TEditN incluye ademas las siguientes propiedades y mtodos:

   EditType        - etString, etInteger, etFloat, etDate, etTime. Consideracin
                     de los datos que contendr el Edit

                     etDate. Permite introducir manualmente parte de la fecha y
                     el Edit termina de completarla.

                     etTime. Permite introducir parte de un tiempo y el Edit
                     termina de completarlo.

   EditAlign       - etAlignRight, etAlignLeft, etAlignCenter, etAlignNone.
                     Alinean la cadena, con respecto a la longitud indicada en
                     EditLengthAlign, cuando EditType = etString

                     etAlignValue. Si EditType = (Integer or FLoat), rellena con
                     0 los espacios a la Izqda. de la cadena, hasta completar la
                     cantidad de caracteres indicada en EditLengthAlign.

                     Respeta el signo negativo si se ha introducido, y el separador
                     decimal contando como un caracter mas de la cadena.

   EditLengthAlign - Longitud de la cadena cuando es alineada. Se tiene en cuenta
                     cuando EditAlign <> etAlignNone, y se cumple lo indicado para
                     EditAlign

   ValueInteger    - Valor Integer del Edit, cuando EditType <> (etString or etTime)
                     Si se produjera un error de conversin devolvera 0

   ValueFloat      - Valor Double del Edit, cuando EditType <> etString
                     Si se produjera un error de conversin devolvera 0

   ValueDate       - Valor TDateTime cuando el Edit es etDate. En este caso, en
                     ValueInteger y ValueFloat, se devuelve el valor Integer o
                     Double de la fecha

   ValueTime       - Valor TDateTime cuando el Edit es etTime. En Value Float 
                     devuelve el valor Double de Time

   EditPrecision   - Permite definir la cantidad de decimales. Si el valor es
                     mayor de 0, formatear el valor, completando con ceros al
                     final si no hay decimales introducidos.

                     ## En el caso de ser valor Float, el separador decimal lo
                     coge por defecto de Windows.

   TimeSeconds     - Se aade la propiedad TimeSeconds, para indicar que cuando
                     el Edit es etTime, rellena los segundos. Todas las
                     variantes de tiempo se completan con 00

   Procedures:

   SetInteger      - Podemos asignar directamente un valor Integer al TEditN,
                     cuando est definido como etInteger Ejemplo:
             
                       EditN10.SetInteger(63565);

   SetFloat        - Podemos asignar directamente un valor Float al TEditN,
                     cuando est definido como etFloat. Ejemplo:

                       EditN9.SetFloat(-63,56);

   SetPtrToData    - Asigna el Edit a una variable, de forma que cuando
                     cambie el valor del Edit, cambiar automticamente
                     el de la variable, y al contrario, por medio del
                     procedimiento Update

   Update          - Actualiza el valor del Edit con el de la variable asignada

                     # Ver la demo para demostracin de como se pueden crear en
                       RunTime arrays de EditN y asignarlas de forma dinmica a
                       Arrays de valores Integer, Float  String en funcin del
                       valor de un indice, lo que permite desplazarse sobre un
                       array con un solo bloque de EditN.

 ###############################################################################
 Version 1.01   05.06.1997

  - Incluye controles para evitar que se genere excepcion al convertir un valor
    Integer, cuando excede de los rangos mximos de dicho tipo.

    En este caso, avisa de que se ha excedido del rango, y deja ValueInteger = 0

  - Incluye control para que cuando es un valor Float no puedan introducirse
    mas de 20 dgitos

 ###############################################################################
 Version 1.02   25.07.1997

  - Corrige un Bug existente cuando el EditType = etString o etFloat, y se carga
    directamente un valor sobre el EditNew, de forma que ValueInteger y
    ValueFloat no se actualizan. Parte del procedimiento DoExit se ha separado
    a Change.

  - Se aade un control para eliminar los caracteres no permitidos, antes de
    convertir a Integer o Float.

  - Value Float se cambia de tipo Extended a Double por ser el genricamente
    mas utilizado.

  - Se aade la propiedad WidthOnFocus para disponer de un ancho del Edit
    configurable cuando este tiene el Foco. Se tiene en cuenta cuando su valor
    es mayor de 0

 -------------------------------------------------------------------------------
 Cambios por Raymond Kleefstra

 - Raymond Kleefstra
 - mail: rkleefstra@tip.nl
 - URL:  http://stad.dsl.nl/~malloc

  - Al pulsar la tecla Escape, anula los cambios, en lugar de borrar el contenido

 ###############################################################################
 Version 1.03   07.12.1997

 - Se corrige un Bug de la versin anterior, por el cual la propiedad MaxLength
   se ponia automticamente con valor 10.

 - Se corrige un Bug que ocurra en modo diseo, al definir etInteger o etFloat,
   y entrar a borrar el valor de Text, daba un error de Rango

 - Se incluye en la conversin de FirstCharUpper en el procedimiento OnExit,
   para el caso de que se cambie a la primera posicin durante la edicin.

 - Se cambia la definicin de los eventos OnKeyPress, On Enter, OnExit, OnChange
   a la parte pblica para poder utilizarlos posteriormente

 - Se incluye la opcin de introducir directamente un valor Integer o Float segn
   este la propiedad EditType, con el procedimiento SetInteger o SetFloat
   respectivamente. Ver la demo para su funcionamiento

 ###############################################################################

 Version 2.0   17.05.1998

 28/04/98 Aadido por Andrea Sessa asessa@nest.it

          FontColorOnFocus    - Cambia el color de la fuente cuando el Edit
                                tiene el foco

          FontColorOnNotFocus - Cambia el color de la fuente cuando el edit
                                pierde el foco

 14/05/98 Aadido por idea de Marcio William liftbr@ibm.net

          - Se actualizan siempre ValueInteger y Value Float cuando el Edit es
            <> de etString

          - Se juntan en el fichero EditNew.Pas los componentes:
            - EditNew      - TEditN
            - MaskEditNew  - TMEditN
            - DBEditNew    - TDbEditN

 15.05.1998 Aadido por Raymond Kleefstra  rkleefstra@tip.nl

          - Procedimientos de conexin del valor del Edit en funcin de su tipo
            etInteger, etFloat, etString a una variable o posicin de un array
            del mismo tipo.

            - SetPtrToData - Asigna el Edit a una variable, de forma que cuando
                             cambie el valor del Edit, cambiar automticamente
                             el de la variable, y al contrario por medio del
                             procedimiento Update

            - Update - Actualiza el valor del Edit con el de la variable asignada

 16/05/1998 Aadido por el autor

            - En la demo se muestra como crear arrays de TEditN en runtime en un
              formulario, y asignarlo directamente a un array de integer, segn
              la conexin que establece el ndice iIndex, as como la forma de
              desplazarse con la array de TEdit sobre el array de integer.

              En funcin del tipo del TEditN, se deber conectar a un array del
              mismo tipo, por ejemplo, si el TEditN es etFloat, el array ser
              float (Double) y se tratar sin ningn tipo de conversin.
              Ver el ejemplo para el caso de Integer.

              Si es etString, en principio tiene que ser ShortString

 ###############################################################################

 Version 2.1   26.05.1998

 24.05.1998 Aadido por el autor

            - Se modifica el cdigo en general, y se dejan comentarios solamente
              en Ingles, optimizndolo en parte para hacer mas entendible el
              mismo. Se implementan las ideas mencionadas a continuacin,
              variando el cdigo con respecto al sugerido por los autores.

 25.05.1998 Por idea de Jos M Torrecilla  -  Zaragoza - Espaa

            - Se aaden los tipos etDate y etTime, orientados a los usuarios que
              prefieren introducir manualmente la fecha o la hora, y el
              componente se encarga de completarla. Por ejemplo:

                Si para una fecha no se indica nada, por defecto coge la actual.

                Si se indica 4, entiende que es el dia 04 del mes y ao actual.

                Si se indica 0510, se completa a 05/10/1998. Si se indica 230695
                entender que es el 23/06/1995, ya que coge el siglo actual por
                defecto.

                Si se quiere indicar una fecha del siglo 21, estando en el siglo
                20, es necesario indicar la fecha completa (Cuando estemos en el
                siglo 21 ya no ser necesario) 17012000 : 17/01/2000.

              En cualquier caso, sirve para indicar la fecha sin separador, ya
              que el Edit pondr por defecto la especificada en la configuracin
              regional de Windows, o para indicar la hora con el separador
              especificado en dicha configuracin.

              En el caso de ser etDate, devuelve en el evento OnExit el valor
              Integer y Double de la fecha indicada en ValueInteger y ValueFloat,
              y si se ha definido el puntero a otra varible, se actualizar
              tambin. Si es etTime, en ValueFloat devuelve el valor Double de
              Time.

            - Se aade la propiedad TimeSeconds, para indicar si cuando el Edit
              es etTime, rellenar o n los segundos. Todas las variantes de
              tiempo se completan con 00

 26.05.1998 - Por idea de Oscar Felis    oscar@callcentereurope.dk

            - Se aade la propiedad FirstCharUpList que hace que convierta a 
              maysculas cualquier letra que se escriba despues de cualquier 
              caracter indicado en la propiedad, siempre que FirstChartUpper 
              sea True. Por defecto es  ' ('  .Por ejemplo:

               Si partimos de los caractres por defecto, se convertir a
               maysculas cualquier letra introducida despues de un caracter de
               espacio o de parntesis.

 ###############################################################################

 Version 2.2   26.12.1998

	       Adaptado a Delphi 4

 ###############################################################################

 Version 2.3   21.02.1999

               Nuevo control de la tecla "Insert" aadido por Jos R. Caamao
               y la propiedad FontColorOnOverWrite aadida por el autor

 ###############################################################################

 Version 2.4   04.08.1999

               Por Alexandre Guillien. email: AGuillien@csi.com

               Nueva propiedad TextHint, que si vale true, muestra un Hint con 
               el contenido del Edit, cuando la longitud del texto del mismo 
               sobrepasa la que se visualiza en el Edit

               Correccin de un bug por el cual cuando el tipo del edit era 
               integer o float, no permita introducir valores negativos si el 
               valor anterior tambin era negativo, y que requera borrar primero 
               el valor anterior


               Por Daniel Inda
               email: regtecmatriz@regtec.com.br               

               Durante la edicin, y cuando el tipo de alineacin es a la derecha 
               o centrada, el contenido del edit se visualiza de igual forma, en 
               lugar de actualizarse solamente al salir

 ###############################################################################

 Al ser Freeware, no se ofrecen garantas de ninguna clase, ni se admiten
 reclamaciones de ningun tipo.

 Este componente puede usarse, distribuirse y modificarse libremente para uso
 particular o didctico, pero no para uso comercial. Para uso comercial ponerse
 en contacto con el autor.

 Este componente puede ponerse en la pgina WEB que se desee, redistribuirse con
 una aplicacin libremente, o incluirse en cualquier libro, CDROM o cualquier
 otro medio, siempre que se incluya el 100% del contenido del componente.

 Se agradecer el que cualquier comentario, correccin o mejora introducida en
 el componente se remita al autor.

