Drawing a Calendar (MonthView) using FLEXGRID [RESOLVED]
I would like to draw my own Calendar into a grid.
It would probably be more like a MonthView, so that I can use it for TODO's.
Using my own grid, would allow partial display of the TODO's, so if more than one on same day, it is obvious.
Also we could have different BackColors to indicate different types, or in my case I would allow user to choose a normal highlight color and also they can mark it urgent with a different color.
Some of the guys have generously helped with a user control calendar (which can have different colors), but not readily convertible to a larger MonthView style.
I have come across an excellent example that uses the flexgrid, but it draws with Monday as the first day of the week.
In Australia we need Sunday.
I think by posting the link, it will be of interest to many of you ?
and that actually did get Sunday to the left, but it carked, on some months (EG Oct 2004)
If someone could tell me how to tweak it to show Sunday as the first day of the week, I would really appreciate it.
Thanks.
PS After I (cough!), get it working in flexgrid, with Sunday on the left, I will then convert my copy to use SGrid2.
If anyone is interested, I will then make that available.
Last edited by RobCrombie; Mar 27th, 2005 at 12:09 AM.
If it is using the Date functions, which has vbUseSystem and the value is 0.
The value for vbSunday would be 1.
But, if it were using the System, wouldn't that already have Sunday as the FirstDayofWeek by default? How is your system calendar set up? Which day is first?
In Regional & Language options, it is set to -
English(Australia).
I couldn't see any other sub choices for picking first day of week, so i'm guessing my system thinks it would be Sunday.
What is more likely is I got lucky by changing the line I posted.
Lucky in the sense that It worked for some less demanding months, but when I scrolled to a month with 31 days, and the starting day was close to the right, it then exceeded the allowable rows. Actually starting on the second row, which causes the overflow.
Careful analyses, would suggest that I did not know what I was doing, and should have been altering other parts of the code, instead.
I'm using Windows XP Home.
I looked in Control Panel's Date and Time, but the only related settings in there was choice of Time Zone.
I have GMT +10 Melbourne, Canberra, Sydney, so that looks ok.
After my problems, I changed the code back to what it was, and scrolled to the months that carked, and they then worked ok.
And Sunday is the first day of the week on the calendar in date/time?
That's how it is here in the US, and there is no place to change it.
I just wondered why it would use Monday as the first day of the week.
I didn't even look at the calendar in Date and Time.
Just had another look, and it too starts on Monday.
Yet, yours starts on Sunday ?
In US do your printed calendars start with Sunday or Monday ?
Maybe the author designed to correct it to Monday (and tough luck elsewhere) ?
Even if I could 'fix' my computer, there is no telling what would happen on my user's computers.
Ideally the code should have a setting for this (which you just suggested)
Re: Drawing a Calendar (MonthView) using FLEXGRID [RESOLVED]
You're the man.
I've got it working.
I tried changing the vbUseSystemDayOfWeek to VBSunday, and I noticed that that argument was an optional default. And the default was VBSunday.
So I tried leaving it out, and it still carked in Oct 2004.
I paid a bit more attention though and noticed it was still starting on the first row. It just couldn't fit 31 in on the 5th row.
So I set the code back to pre-Crombie, and watched it as I scrolled back.
Whenever I reached a month with 31 days that started very close to the right (1st of month on say Saturday), it would resize the rows so as to allow 6 rows.
(My code only had 5 rows, and carked.)
So I went looking for a 2nd possible spot that also needed changing, and found it. It too had one of those vbUseSystemDayOfWeek.
By leaving that one off, it also will default to VBSunday.
Here are the changes, for anyone wishing to use the code -
Re: Drawing a Calendar (MonthView) using FLEXGRID [RESOLVED]
Not a problem, but to help others, as well as myself (possibly) why don't you post it ? It might even get moved to the CodeBank.
I don't mind doing that -
- Flexgrid version
- SGrid2 version
and even a version with both
- Flexgrid and SGrid2 on the same form.
However I suspect that would be bad (illegal ?)
The actual author (which can be seen by following the link I posted), is a very experienced programmer(guru), and an ex moderator from his site.
I think he would be annoyed, and the moderators here would give me a severe admonishing.
Re: Drawing a Calendar (MonthView) using FLEXGRID [RESOLVED]
Sorry for delay,
I have been modifying it to use SGrid2, and then building it into my current project. And it works ok.
Just the flexgrid version would be cool.
I'm attaching the flexgrid version.
It may not give you Sunday on the left.
If it doesn't there are two lines, where I indicate that you comment them out,
and uncomment the lines below them.
That would then give the version I used (in Aust), to get Sunday on the left.
I probably should return to this post and delete it in a day or so ?
(because it is bad, to post it ?)
Re: Drawing a Calendar (MonthView) using FLEXGRID [RESOLVED]
Who is flyguy? Is that you? I don't think it would be bad to post it, unless he specified not to reproduce it like they do at psc. I got one deleted, even though I left it intact with the warnings. It would be really cool with a transparent form. My buddy has one that runs on his desktop all the time.