Página 1 de 1

TUpDown

Publicado: Lun Abr 03, 2006 11:59 am
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)Â

TUpDown

Publicado: Lun Abr 03, 2006 12:09 pm
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 !!!
>
>

TUpDown

Publicado: Lun Abr 03, 2006 12:39 pm
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

TUpDown

Publicado: Lun Abr 03, 2006 3:20 pm
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
>

TUpDown

Publicado: Lun Abr 03, 2006 6:42 pm
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