Board index » delphi » Formatting DBEdit input: 2nd part

Formatting DBEdit input: 2nd part

First, thanks for the reply on my previous question on this subject.

I've entered values in the DisplayFormat and EditMask fields as follows:
  DisplayFormat = hh:nn
  EditMask = !90:00:1:_

All looks great, until I enter the DBEdit. At this point not hours and
minutes, but hours and seconds appear in the DBEdit. For example if the time
to display is 10:00:30, 10:00 appears in the DBEdit when not in focus. If in
focus 10:30 appears (should be 10:00).

What to do about it?

Thanks

Roy

 

Re:Formatting DBEdit input: 2nd part


Don't know if this answers your question, but why are you using
  DisplayFormat = hh:nn
and not
  DisplayFormat = hh:mm

Set

Quote
Roy Rutten wrote:
> First, thanks for the reply on my previous question on this subject.

> I've entered values in the DisplayFormat and EditMask fields as follows:
>   DisplayFormat = hh:nn
>   EditMask = !90:00:1:_

> All looks great, until I enter the DBEdit. At this point not hours and
> minutes, but hours and seconds appear in the DBEdit. For example if the time
> to display is 10:00:30, 10:00 appears in the DBEdit when not in focus. If in
> focus 10:30 appears (should be 10:00).

> What to do about it?

> Thanks

> Roy

Re:Formatting DBEdit input: 2nd part


"Svein Erling Tysv?r" schrieb:

Quote

> Don't know if this answers your question, but why are you using
>   DisplayFormat = hh:nn
> and not
>   DisplayFormat = hh:mm

AFAIK mm is the Month code

-Michael

Re:Formatting DBEdit input: 2nd part


Oops, sorry. Never had to use displayformat myself, and simply assumed
mm meant minutes.

Set

Quote
Michael Winter wrote:
> "Svein Erling Tysv?r" schrieb:

> > Don't know if this answers your question, but why are you using
> >   DisplayFormat = hh:nn
> > and not
> >   DisplayFormat = hh:mm

> AFAIK mm is the Month code

> -Michael

Re:Formatting DBEdit input: 2nd part


Quote
Roy Rutten <no.junkmail.roy.rut...@xarmac.nl> wrote in message

news:7ssdv3$nvq$1@reader1.wxs.nl...

Quote
> I've entered values in the DisplayFormat and EditMask fields as follows:
>   DisplayFormat = hh:nn
>   EditMask = !90:00:1:_

> All looks great, until I enter the DBEdit. At this point not hours and
> minutes, but hours and seconds appear in the DBEdit. For example if the
time
> to display is 10:00:30, 10:00 appears in the DBEdit when not in focus. If
in
> focus 10:30 appears (should be 10:00).

Roy,

This came up a few months ago in one of the Delphi newsgroups and no one was
able to offer a solution (publicly, at any rate).

The D2 help files go so far as to claim that TTimeField has an EditFormat
property, which sounds promising... until you find there is no such thing -
even as a protected property.

Maybe there's a third-party component out there somewhere that handles this
correctly. The only other alternatives I can suggest are 1) use a non
data-aware
component such as TEdit and do the formatting and reading/writing in code;
or 2) write your own component.

--
Stephen Brown

Re:Formatting DBEdit input: 2nd part


In article <7ssdv3$nv...@reader1.wxs.nl>, "Roy Rutten"

Quote
<no.junkmail.roy.rut...@xarmac.nl> writes:
>All looks great, until I enter the DBEdit. At this point not hours and
>minutes, but hours and seconds appear in the DBEdit. For example if the time
>to display is 10:00:30, 10:00 appears in the DBEdit when not in focus. If in
>focus 10:30 appears (should be 10:00).

I would hazard a guess that it's because the character stream being forced into
the display is '10:00:30' and the last two "excess" characters are forced into
the last two places so the seconds characters display as minutes.

Have you tried setting the text in the TField.GetText event handler, On my
trivial testing it appears to work at run-time but not at design-time.

procedure TForm1.Table1TestTimeGetText(Sender: TField; var Text: String;
  DisplayText: Boolean);
begin
  Text := FormatDateTime('hh:nn', Sender.Value);
end;

Alan Lloyd
alangll...@aol.com

Other Threads