MonthCalendar and current month

77 views
Skip to first unread message

Grzegorz R.

unread,
Mar 23, 2021, 1:00:24 PMMar 23
to
Hello
I use MonthCalendar instead of RighSLE because MC has week numbers (what RSLE does not) so I would like to stick with that.
I have MC streched vertically to have 3 months at once.
My problem is that the top month is NOT the current one of selected or current date - for example today (23/03) it shows Jan-Mar instead of Mar-May.
Surprisingly at design (editor) it works/shows fine.
Is there a way to force MC to start with month of selected/given date?
Greetings
Gregory

D.J.W. van Kooten

unread,
Mar 24, 2021, 6:47:02 AMMar 24
to
Replying on message of Tue, 23 Mar 2021 10:00:23 -0700 (PDT) from
Grzegorz R.:


Hello Grzegorz R.

>I have MC streched vertically to have 3 months at once.
>My problem is that the top month is NOT the current one of selected or current date - for example today (23/03) it shows Jan-Mar instead of Mar-May.
>Surprisingly at design (editor) it works/shows fine.
>Is there a way to force MC to start with month of selected/given date?

Hello Gregory,

I am not sure what you are doing, I'll explain what I am doing:

I have a datawindow on which I have 12 month calendar controls (3 rows
of 4) so a user can set days off for employees by directly selecting
one or more dates.

In the design mode it now shows March 2021 for every of the 12 month
calendars (as it is now Match 2021) .

Then, on postinit, I call a method to determine what I want to see as
first month (which is the previous month) in the first monthcalendar
(mc1) and after that I set all the other controls (mc2-mc12) as well,
like this:


LOCAL oDR AS DateRange
LOCAL dDatum AS DATE


dDatum:=BoM(dStart-35) // Begin at last month
oDR:=DateRange{dDatum,dDatum+1} // set 1 day range for next
control
SELF:oDCmc1:Selectionrange:=oDR // set date range to this day

(//set dDatum to next month and then):
SELF:oDCmc2:Selectionrange:=oDR // set date range to this day

etc for all controls mc1-mc12

Does this help?

Dick

Grzegorz R.

unread,
Apr 1, 2021, 12:03:51 PMApr 1
to
Hello Dick
sorry to be quiet a while...

First - I do not understand why You use 12 separate month calendar controls instead of use one streched (if You strech MC horizontal and/or vertical You will se more that one month - I'm pretty sure You know that). Using 12 controls sounds quite complicated to me instead of one.

Second - I do not want to restrict date range but just position a 3-month control so that current -1 month is the first one. In march I saw Jan-Mar range and now I see Apr-Jun but want at any time to see M-1 to M+1 to current date.
I'm not able to achieve that...

Hope that helps to help but can also put somewhere snapshots what I mean if Yo like...

Kind regards
Gregory

D.J.W. van Kooten

unread,
Apr 7, 2021, 6:07:40 AMApr 7
to
Replying on message of Thu, 1 Apr 2021 09:03:50 -0700 (PDT) from
Grzegorz R.:


Hello Grzegorz,

>First - I do not understand why You use 12 separate month calendar controls instead of use one streched (if You strech MC horizontal and/or vertical You will se more that one month - I'm pretty sure You know that). Using 12 controls sounds quite complicated to me instead of one.

>Second - I do not want to restrict date range but just position a 3-month control so that current -1 month is the first one. In march I saw Jan-Mar range and now I see Apr-Jun but want at any time to see M-1 to M+1 to current date.
>I'm not able to achieve that...
>

It is well possible that I didn't know that when I wrote this long
ago:)

Could it be that your range problem exists because you use one
stretched control, as I don't have that problem with the code I
provided in my previous answer using 12 separate controls?

Dick
Reply all
Reply to author
Forward
0 new messages