Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

about TDateTimePicker

0 views
Skip to first unread message

Gabriel Briviesca

unread,
Nov 18, 1999, 3:00:00 AM11/18/99
to
hi, i was wondering if i could assign a TdateTimePicker a default value
of the date when it appears... i wanted to know this so that i wouldn'd
have to write code to do this... thank u very much!

o yeah! if this isn't the newsgroup that i had to post this
question... could you tell me where!

again... thanks for your help....


Paul Hughes

unread,
Nov 18, 1999, 3:00:00 AM11/18/99
to
You should be able to say:

MyDateTimePicker.Date := SysUtils.Date; { current system date }

or
MyDateTimePicker.Date := StrToDate('18/11/99') { some other date }

Paul

Gabriel Briviesca <gab...@bajaware.com> wrote in message
news:<38346097...@bajaware.com>...

Gabriel Briviesca

unread,
Nov 18, 1999, 3:00:00 AM11/18/99
to
ok... and is there is a way to change a property of the TdateTimePicker so
that it'll get this date and I wouldn't have to write this lines of code?

by the way... thanks for your answer! :)

Wayne Niddery (TeamB)

unread,
Nov 18, 1999, 3:00:00 AM11/18/99
to
Gabriel Briviesca wrote in message <38347CBA...@bajaware.com>...

>ok... and is there is a way to change a property of the TdateTimePicker so
>that it'll get this date and I wouldn't have to write this lines of code?

You must *really* hate writing code!

Your choice is setting properties in the object inspector - but then you're
stuck with whatever date you set there, or writing a line of code so it
always has the current date when the program runs.

--
Wayne Niddery - WinWright Consulting
RADBooks - http://members.home.net/wniddery/
Toronto Delphi Users Group - http://www.tdug.com/


Gabriel Forner

unread,
Nov 18, 1999, 3:00:00 AM11/18/99
to
You can create a descendent (please note this involves writing code) that sets
the date when the component is instantiated.

-Gabe

Gabriel Briviesca wrote:

> ok... and is there is a way to change a property of the TdateTimePicker so
> that it'll get this date and I wouldn't have to write this lines of code?
>

Bob Green

unread,
Nov 18, 1999, 3:00:00 AM11/18/99
to
Might be a nice enhancement for D6? If Date = 0 and Time = 0, set to
SysUtil.Date ..


Gabriel Briviesca wrote:

> hi, i was wondering if i could assign a TdateTimePicker a default value
> of the date when it appears... i wanted to know this so that i wouldn'd
> have to write code to do this... thank u very much!
>
> o yeah! if this isn't the newsgroup that i had to post this
> question... could you tell me where!
>
> again... thanks for your help....

--
Bob Green
Office Tech, Inc.
(317) 594-3240

Gabriel Briviesca

unread,
Nov 19, 1999, 3:00:00 AM11/19/99
to
i know i sounded lazy... but i was asking because i have a "lot" of
TDateTimePicker's y my form and i just wanted to know if there was a better way
to do it... i hope that D6 has a way to put today's date by default or
something like that (idea by Bob Green).... anyway thank u all for MY FIRST
experience in newsgroups, it's been a lot of fun ! :)

(sorry if this wasn't a question and somebody got mad... it's just that i'm
grateful for your comments)

Your friend Gabriel!

"Wayne Niddery (TeamB)" wrote:

> Gabriel Briviesca wrote in message <38347CBA...@bajaware.com>...

> >ok... and is there is a way to change a property of the TdateTimePicker so
> >that it'll get this date and I wouldn't have to write this lines of code?
>

Wayne Niddery (TeamB)

unread,
Nov 19, 1999, 3:00:00 AM11/19/99
to
Gabriel Briviesca wrote in message <38359853...@bajaware.com>...

>i know i sounded lazy... but i was asking because i have a "lot" of
>TDateTimePicker's y my form and i just wanted to know if there was a better
way
>to do it... i hope that D6 has a way to put today's date by default or
>something like that (idea by Bob Green)

If there are a lot of datetimepickers, then in the OnCreate event perform a
loop to find all of these and set them:

for i := 0 to ControlCount - 1 do begin
if Controls[i] is TDateTimePicker then
TDateTimePicker(Controls[i]).Date := Date;
end;

0 new messages