In order for this site to work correctly we need to store a small file (called a cookie) on your computer. Most every site in the world does this, however since the 25th of May 2011, by law we have to get your permission first. Please abandon the forum if you disagree.

Para que este foro funcione correctamente es necesario guardar un pequeño fichero (llamado cookie) en su ordenador. La mayoría de los sitios de Internet lo hacen, no obstante desde el 25 de Marzo de 2011 y por ley, necesitamos de su permiso con antelación. Abandone este foro si no está conforme.

TUpDown

Foro público de Xailer en español
Responder
Aguiar Costa
Mensajes: 115
Registrado: Jue Jun 01, 2006 7:21 pm

TUpDown

Mensaje por Aguiar Costa »

Hi !!!
I have 2 UpDown objects, one designed on the IDE and the other one designed
in code. The first works just fine, but the second is initialized (TEdit
buddy) with the value in the updown property nMin...after the initialization
the incremantation works fine !!!
What am i doing wrong ? What makes the edit object initialize with
TUpDown:nMin ???
TIA.
Aguiar !!!


Attached files UpDown.zip (1.6 KB)Â
Aguiar Costa
Mensajes: 115
Registrado: Jue Jun 01, 2006 7:21 pm

TUpDown

Mensaje por Aguiar Costa »

I found out that it does the initialization because the edit control is
ReadOnly...Is this the right behavior?
TIA.
Aguiar !!!
"Aguiar Costa" <Aguiar.Costa@Sisbit.pt> escreveu na mensagem
news:[email=4430f1f5@ozsrvnegro.ozlan.local...]4430f1f5@ozsrvnegro.ozlan.local...[/email]
> Hi !!!
> I have 2 UpDown objects, one designed on the IDE and the other one
> designed in code. The first works just fine, but the second is initialized
> (TEdit buddy) with the value in the updown property nMin...after the
> initialization the incremantation works fine !!!
> What am i doing wrong ? What makes the edit object initialize with
> TUpDown:nMin ???
> TIA.
> Aguiar !!!
>
>
Avatar de Usuario
jfgimenez
Site Admin
Mensajes: 5718
Registrado: Lun Abr 06, 2015 8:48 pm
Contactar:

TUpDown

Mensaje por jfgimenez »

Aguiar,
> I have 2 UpDown objects, one designed on the IDE and the other one
> designed in code. The first works just fine, but the second is initialized
> (TEdit buddy) with the value in the updown property nMin...after the
> initialization the incremantation works fine !!!
> What am i doing wrong ? What makes the edit object initialize with
> TUpDown:nMin ???
The problem is the value assigned to the edit control. When the user clicks
on the updown control, it evaluates the content of the edit control, and the
result is 0 (it has an extra space at the beginning). So, it assign the nMin
value to the edit control.
Please, change the line:
:Value := Year(Date())
to
:Value := LTrim( Str( Year(Date()) ) )
--
Regards,
Jose F. Gimenez
José F. Giménez
[Equipo de Xailer / Xailer team]
http://www.xailer.com
http://www.xailer.info
Aguiar Costa
Mensajes: 115
Registrado: Jue Jun 01, 2006 7:21 pm

TUpDown

Mensaje por Aguiar Costa »

Hello Jose,
Thank you for your help, but i dont tnhink that that is the problem...like i
said on my previous post if you set the edit control property lReadOnly to
..F. , it will work correctly !!! So maybe this is a bug...If not tell me, so
i can change my code.
Thanks again for the quick response.
Regards
Aguiar !!!
"Jose F. Gimenez" <jfgimenez@wanadoo.es> escreveu na mensagem
news:[email=4430fb68@ozsrvnegro.ozlan.local...]4430fb68@ozsrvnegro.ozlan.local...[/email]
> Aguiar,
>
>> I have 2 UpDown objects, one designed on the IDE and the other one
>> designed in code. The first works just fine, but the second is
>> initialized (TEdit buddy) with the value in the updown property
>> nMin...after the initialization the incremantation works fine !!!
>> What am i doing wrong ? What makes the edit object initialize with
>> TUpDown:nMin ???
>
> The problem is the value assigned to the edit control. When the user
> clicks on the updown control, it evaluates the content of the edit
> control, and the result is 0 (it has an extra space at the beginning). So,
> it assign the nMin value to the edit control.
>
> Please, change the line:
>
> :Value := Year(Date())
>
> to
>
> :Value := LTrim( Str( Year(Date()) ) )
>
> --
> Regards,
>
> Jose F. Gimenez
>
Avatar de Usuario
jfgimenez
Site Admin
Mensajes: 5718
Registrado: Lun Abr 06, 2015 8:48 pm
Contactar:

TUpDown

Mensaje por jfgimenez »

Aguiar,
> Thank you for your help, but i dont tnhink that that is the problem...like
> i said on my previous post if you set the edit control property lReadOnly
> to .F. , it will work correctly !!! So maybe this is a bug...If not tell
> me, so i can change my code.
Well, I saw this behaviour this morning, but I have to insist: remove any
extra spaces and you'll see that it works fine.
Respecting the readonly flag, I'm affraid that it indeed causes a strange
behaviour, but it depends on windows API and we can't do anything.
--
Regards,
Jose F. Gimenez
José F. Giménez
[Equipo de Xailer / Xailer team]
http://www.xailer.com
http://www.xailer.info
Responder