Default Start Year for wwdbDateTimePicker

101 views
Skip to first unread message

ldman...@gmail.com

unread,
May 5, 2017, 10:33:54 AM5/5/17
to woll2woll.infopower
I am using DELPHI XE7 over windows 10 64bit with your Infopower and 1stClass components and am trying to modify my StartYear on the wwDBDateTimePicker throughout my application.

I found this post on the subject in an old post:

http://www.codenewsfast.com/cnf/thread/0/permalink.thr-ng1691q8276

So I modified the global property ‘wwMonthCalendarPopupStartYearDefault’ to 2010 in my wwIntl.pas file.
This appeared to have an effect on the wwDBMonthCalendar but the wwDBDateTimePicker still defaults to the year 2000.

Is there something else I have to do?

Thanks,

Leonard

Roy Woll

unread,
May 5, 2017, 12:57:10 PM5/5/17
to ldman...@gmail.com, woll2woll.infopower
Hi Leonard,

I think you must have the property already set in the actual TwwDBDateTimePicker so its overriding the global property setting. Could this be the case? See the PopupYearOptions..StartYear property and see if it has changed from the default 2000. If so, the TwwIntl would have no effect.

-Roy
--
You received this message because you are subscribed to the Google Groups "woll2woll.infopower" group.
To unsubscribe from this group and stop receiving emails from it, send an email to woll2wollinfopo...@googlegroups.com.
Visit this group at https://groups.google.com/group/woll2wollinfopower.
To view this discussion on the web visit https://groups.google.com/d/msgid/woll2wollinfopower/2cafd9db-af39-4ca8-adfd-cb59cd66e39f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

ldman...@gmail.com

unread,
May 5, 2017, 1:06:29 PM5/5/17
to woll2woll.infopower, ldman...@gmail.com
Thanks for the reply, Roy.

The StartYear property is set to 2000 on all the datetime pickers in my application. This must be by default as I have never modified this property. Even when I drop a new TwwDBDatetimePicker on a form it still has 2000 as the StartYear. However, the TwwDBMonthCalendar StartYear has changed to 2010.

Is there somewhere that sets that StartYear property on the TwwDBDateTimePicker that overrides the value coming from TwwIntl. I even tried dropping a TwwIntl component on my base form and changed it's StartYear property to 2010.

Nothing has affected the StartYear property on the TwwDBDateTimePicker.

Leonard

Roy Woll

unread,
May 5, 2017, 1:35:26 PM5/5/17
to ldman...@gmail.com, woll2woll.infopower
Did you set the TwwIntl connected property to true? Do you have any other TwwIntl components in your project that could be overriding this setting?

-Roy

-----Original Message-----
From: woll2woll...@googlegroups.com [mailto:woll2woll...@googlegroups.com] On Behalf Of ldman...@gmail.com
--
You received this message because you are subscribed to the Google Groups "woll2woll.infopower" group.
To unsubscribe from this group and stop receiving emails from it, send an email to woll2wollinfopo...@googlegroups.com.
Visit this group at https://groups.google.com/group/woll2wollinfopower.
To view this discussion on the web visit https://groups.google.com/d/msgid/woll2wollinfopower/2bd0e238-37ba-4c62-aa73-c4e3bb1dbc03%40googlegroups.com.

ldman...@gmail.com

unread,
May 5, 2017, 3:18:46 PM5/5/17
to woll2woll.infopower, ldman...@gmail.com
I have set the connected property to True.
I can see the settings working properly on the wwDBMonthCalendar component. I set the wwMonthCalendarPopupStartYear property in the wwIntl.pas to 2010 and the default shows up on the wwDBMonthCalendar as 2010, as expected. The wwDBDateTimePicker default is still 2000. I then added the TwwIntl component to my base form and set the StartYear Default to 2015. wwDBMonthCalendar Default shows as 2015, as expected. But the wwDBDateTimePicker Default still shows 2000.

Roy Woll

unread,
May 5, 2017, 6:02:38 PM5/5/17
to ldman...@gmail.com, woll2woll.infopower
I’m not sure about the cause of your problem as it seems to work for me (I tried it with our maindemo), although I am using a more recent version of InfoPower. Are your monthcalendar and datetimepicker on the same form? Check your .dfm file to see if it is storing the StartYear in the .dfm. You could also try compiling with our source and setting a breakpoint at vcl.wwmonthcalendar.pas -GetStartYear to see why its getting the wrong value.

function TwwPopupYearOptions.GetStartYear: integer;
begin
if csDesigning in wwInternational.ComponentState then
result:= FStartYear
else begin
if FStartYear<> wwMonthCalendarPopupStartYearDefault then
result:= FStartYear
else
result:= wwInternational.MonthCalendar.PopupYearStart
end;
end;


-Roy


-----Original Message-----
From: woll2woll...@googlegroups.com [mailto:woll2woll...@googlegroups.com] On Behalf Of ldman...@gmail.com
Sent: Friday, May 5, 2017 12:19 PM
To: woll2woll.infopower <woll2woll...@googlegroups.com>
Cc: ldman...@gmail.com
Subject: Re: Default Start Year for wwdbDateTimePicker

--
You received this message because you are subscribed to the Google Groups "woll2woll.infopower" group.
To unsubscribe from this group and stop receiving emails from it, send an email to woll2wollinfopo...@googlegroups.com.
Visit this group at https://groups.google.com/group/woll2wollinfopower.
To view this discussion on the web visit https://groups.google.com/d/msgid/woll2wollinfopower/689ad507-a8a8-4a1e-acf9-9c85c94f8a28%40googlegroups.com.

ldman...@gmail.com

unread,
May 8, 2017, 11:19:37 AM5/8/17
to woll2woll.infopower, ldman...@gmail.com
I'm so sorry for wasting your time, Roy.

I discovered that the problem was project specific when I tried creating a new project and the startyear defaulted properly.

So focused specifically on my project and found some code in my base form that reset the CalendarAttributes.PopupYearOptions.StartYear property. I don't know how I missed this last week.

if Self.Components[Counter] is TwwDBDateTimePicker then
begin
with Self.Components[Counter] as TwwDBDateTimePicker do
begin
if (Enabled = True) then
begin
if (Tag = 99) then
Color := clRed
else
if (Tag = 98) then
Color := clYellow;
end;

CalendarAttributes.PopupYearOptions.StartYear := 2000;
end;
end

It must have been a throwback to D7 when perhaps the wwIntl.pas was not defaulting the StartYear. Anyway, I removed the line of code and the DateTimePickers are now defaulting to the value in wwIntl.pas.

Thank You for your help.

Leonard

Reply all
Reply to author
Forward
0 new messages