Board index » delphi » 'Short Time' EditMask shows Hours:Seconds

'Short Time' EditMask shows Hours:Seconds

Hello,

I've got a weird problem here:
The time entered into a DateTime field is 12.04.1988 12:30:55

When using the standard Short Time edit mask, the inplace editor shows
really weird things when brought up:
!90:00;0;_    >>  12:55
!90:00;0;_    >>  12.04.1988 12:30::55

It works like this
** in TDBGrid and TDBEdit;
** with ADO, ClientDataSet, BDE;
** in Delphi5, Delphi6 and Delphi7 pro;
** in Windows2000 and Windows98.

I wonder what might be wrong in here?

((I haven't tried to change my country and language settings yet, but it's
not really a solution to explain to end users that they'll have to use pure
US setup in order to use my programs))

Tarvo Hirs

 

Re:'Short Time' EditMask shows Hours:Seconds


Quote
>I've got a weird problem here:
>The time entered into a DateTime field is 12.04.1988 12:30:55

>When using the standard Short Time edit mask, the inplace editor shows
>really weird things when brought up:
>!90:00;0;_    >>  12:55
>!90:00;0;_    >>  12.04.1988 12:30::55

If you are trying to show a datetimefield formatted as shortTime you should be
using the TdateTiemField.displayformat property not the editMask property.
--
Brian Bushay (TeamB)
Bbus...@NMPLS.com

Re:'Short Time' EditMask shows Hours:Seconds


Thanks, Brian

I've gone though all possible combinations, but the feature persists unless
I change the value of the LongTimeFormat constant.

The display text is OK in any situation, the problem is that the initial
text in InplaceEditor shows hours:seconds instead of hours:minutes when
TdateTiemField.EditMask is set to Short Time, TdateTiemField.DisplayFormat
is hh:nn and LongTimeFormat is h:nn:ss, as it normally is in my country.

Brian, can you please check if things are the same way on your computer and
let me know whether you can reproduce the Hours:Seconds effect? If not, then
the reason may be in different country and language settings, or then again,
it may be just a bug. I'll send a simple D5 project I have experimented with
to your e-mail, I assume it's not good practice to copy-paste files into
newsgroup.

Thank you in advance,

Tarvo

"Brian Bushay TeamB" <BBus...@Nmpls.com> wrote in message

Quote
> If you are trying to show a datetimefield formatted as shortTime you
should be
> using the TdateTiemField.displayformat property not the editMask property.

Re:'Short Time' EditMask shows Hours:Seconds


Quote
>I've gone though all possible combinations, but the feature persists unless
>I change the value of the LongTimeFormat constant.

>The display text is OK in any situation, the problem is that the initial
>text in InplaceEditor shows hours:seconds instead of hours:minutes when
>TdateTiemField.EditMask is set to Short Time, TdateTiemField.DisplayFormat
>is hh:nn and LongTimeFormat is h:nn:ss, as it normally is in my country.

If you are going to edit a time field you have to provide all the components of
the longtimeformat.  If you just want to display time use the
Tdatetimefield.displayformat property and do not use editmask.

--
Brian Bushay (TeamB)
Bbus...@NMPLS.com

Re:'Short Time' EditMask shows Hours:Seconds


Quote
> If you are going to edit a time field you have to provide all the
components of
> the longtimeformat.  If you just want to display time use the
> Tdatetimefield.displayformat property and do not use editmask.

Brian, you are explaining how this thing works, but the problem is that it
doesn't work the way one would expect. The idea is to get rid of the
seconds, that's why I'm using both displayformat and editmask. When someone
asks "What time it is?" I may answer "nine-tentytwo", but never
"nine-twentytwo-seven{*word*249}-and-counting", if you understand what I mean.

What I'm pointing at is the fact that InplaceEditor doesn't take into
account the actual display format of the data-aware control, the value of
which it is editing.

Tarvo Hirs

Re:'Short Time' EditMask shows Hours:Seconds


Quote
>Please keep newsgroup responses on the Newsgroup and out of Email

I'm very-very sorry about that, I'll remove that ReplyToSender button from
my newsreader.
Please forgive me,

Tarvo

Re:'Short Time' EditMask shows Hours:Seconds


Quote
>Brian, you are explaining how this thing works, but the problem is that it
>doesn't work the way one would expect. The idea is to get rid of the
>seconds, that's why I'm using both displayformat and editmask. When someone
>asks "What time it is?" I may answer "nine-tentytwo", but never
>"nine-twentytwo-seven{*word*249}-and-counting", if you understand what I mean.

Your expectations are askew.
Displayformat affects only the display of a field.  
If you want to edit a time field you have to have to provide all the components
of the time default you have set in Windows.

EditMask is not a property you use to control display or format.  
Edit mask only limits entry to a specific set of characters it does not insure
that those characters are valid for the field type.
--
Brian Bushay (TeamB)
Bbus...@NMPLS.com

Re:'Short Time' EditMask shows Hours:Seconds


Quote
> Your expectations are askew.

I'm defending the human rights here ;)

You sound like the Windows is a holy cow no-one can tamper with. What makes
one inplace editor so special? The whole Delphi concept is about
transforming the Windows to more readable and understandable format, at
least that's why I have used it since version 3.

Quote
> If you want to edit a time field you have to have to provide all the
components
> of the time default you have set in Windows.

In Windows there is only one time and date format activated at any time,
which is clearly too restrictive. And what is more important, relying only
to Windows' time settings can make any program to act weird, as showing
Hours:Seconds instead of Hours:Minutes to unprepared audience indicates.
Delphi program has its own ShortTime and LongTime formats, which are not
configurable through ControlPanel during the program execution, and changing
of which does not affect the Windows' behaviour globally.

Quote
> Edit mask only limits entry to a specific set of characters it does not
insure
> that those characters are valid for the field type.

Well, exaclty. Because the two things, Edit Mask of the component, and
Display Format of the very same component are not evaluated together. It's
not against common logic to expect they should.

Regards,
Tarvo

"Brian Bushay TeamB" <BBus...@Nmpls.com> wrote in message
news:20ifoukon4n66d18mnqml0h7i7s6lmpoql@4ax.com...

Quote
> Your expectations are askew.
> Displayformat affects only the display of a field.

> EditMask is not a property you use to control display or format.
> --
> Brian Bushay (TeamB)
> Bbus...@NMPLS.com

Re:'Short Time' EditMask shows Hours:Seconds


Quote
>I'm defending the human rights here ;)

>You sound like the Windows is a holy cow no-one can tamper with. What makes
>one inplace editor so special? The whole Delphi concept is about
>transforming the Windows to more readable and understandable format, at
>least that's why I have used it since version 3.

No I am just commenting on how delphi works.  Sounds like you should be creating
your own set of components delphi will allow you to do that.

--
Brian Bushay (TeamB)
Bbus...@NMPLS.com

Other Threads