TEdit y LimitText

TEdit y LimitText

Postby Xevi » Tue Feb 20, 2018 10:53 am

Estoy intentando hacer con un TEdit con valor de la variable numérico, ponerle una longitud máxima y no quiere, no funciona, o lo hago mal.

Code: Select all  Expand view

Static nNum1 := 37
...
Local oEditNum1
...
@ 5, 100 EDIT oEditNum1 VAR nNum1 SIZE 47, 21 LIMITTEXT BY 5 CHARS FONT oFont10 PIXEL OF oWnd
 


He intentado...

Code: Select all  Expand view

oEditNum1:lLimitText := .T.
oEditNum1:nLimitChars := 5
 


pero nada... puedo introducir tanto texto (números, de eso se trata) como quiera, no se establece el límite en 5 dígitos.
Un Saludo,
Xevi.

Aprendiz de la vida!!!
User avatar
Xevi
 
Posts: 169
Joined: Wed Nov 29, 2017 11:42 am
Location: Girona

Re: TEdit y LimitText

Postby Xevi » Tue Feb 20, 2018 4:57 pm

El tema de utilizar variables numéricas en Edit y limitar la longitud, como va a ser que no... pues utilizo variable de texto, con la cláusula NUMBER y limitando el texto a 5 caracteres

@ 20, 85 EDIT oEditNum1 VAR cNum1 SIZE 45, 21 FONT oFont10 PIXEL RIGHT NUMBER LIMITTEXT BY 5 CHARS OF oWnd

luego, solo es custion de pasar el valor del texto de oEditNum1 a Val() y tema solucionado!!!

Bien, por ahora, porque el tema de pictures y demás con TEdit(), eso de momento no lo he probado, y no se si se podrá o deberé de utilizar TGet()

Gracias.
Un Saludo,
Xevi.

Aprendiz de la vida!!!
User avatar
Xevi
 
Posts: 169
Joined: Wed Nov 29, 2017 11:42 am
Location: Girona

Re: TEdit y LimitText

Postby nageswaragunupudi » Tue Feb 20, 2018 5:09 pm

We suggest using TEdit only for entering character values of variable length without picture clauses.
For variables of all other types as well as text with picture clauses, TGet is best suited.

TEdit:
This is more suitable for text fields from RDBMS (eg. mysql, mssql, etc).
Here we have character fields with variable length, eg. VarChar(n).

If we want to use TGet, we need to first pad the value, use TGet and then trim the result and save it.
With TEdit this process is not required.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10206
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: TEdit y LimitText

Postby Xevi » Tue Feb 20, 2018 5:21 pm

Rao,

GET no es un control que me guste utilizar, por sus espaciados y longitudes "fijas", no se corresponden muchas veces con la realidad, de ahí el control TEdit es el que más se asemeja a la realidad en el momento de introducción de datos, aunque con una máscara (picture) igual SI que el GET sea el más apropiado... iré avanzando en el aprendizaje de FW y a ver con que problemillas me voy encontrando!!!


Gracias.
Un Saludo,
Xevi.

Aprendiz de la vida!!!
User avatar
Xevi
 
Posts: 169
Joined: Wed Nov 29, 2017 11:42 am
Location: Girona

Re: TEdit y LimitText

Postby nageswaragunupudi » Thu Feb 22, 2018 2:17 am

but nothing ... I can enter as much text (numbers, that's it) as you want, the limit is not set in 5 digits.


Limitbychars is implemented only for character values, not for numerics. For numerics, appropriate control is TGet.

GET is not a control that I like to use, because of its "fixed" spacings and lengths, they do not correspond many times with reality, hence the control TEdit is the one that most resembles reality at the time of introduction of data, although with a mask (picture) equal IF that the GET is the most appropriate ... I will go forward in the learning of FW and to see what little problems I'm encountering !!!


That is purely your personal taste.
I already stated the official clarification of FWH about which control is suitable for what purpose. That is how FWH built these controls. If you still want to use TEdit in all cases, that is a matter of your personal taste, but please keep in mind its limitations.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10206
Joined: Sun Nov 19, 2006 5:22 am
Location: India


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 8 guests