Pelles C forum

Pelles C => Projects developed with Pelles C => Topic started by: John Z on February 21, 2025, 10:11:35 PM

Title: Simple Calendar
Post by: John Z on February 21, 2025, 10:11:35 PM
So who wants to fire up Google, Outlook, or other gigantic program just to look at a calendar? 
Not me.  So attached here is a simple calendar with a 6 months view, too simple really, but useful.

A bit more useful since one can also find the number of days from a start day to an end day,inclusive.
Also it can be used to show the resulting date once given a start date and +/- a number of days.
Lastly, it can also set a simple alert for a date & time.  This is a one shot alert, no repeat function.

Simple, but hopefully useful.

John Z

Updated program per Marco's input - revised program and replaced the original one here.

7/11/2026 Newer version attached further down the posting so code removed from here to save space -
Title: Re: Simple Calendar
Post by: Vortex on February 22, 2025, 11:01:40 AM
Hi John,

Thanks, your application works fine on Windows 7.
Title: Re: Simple Calendar
Post by: John Z on February 22, 2025, 09:59:17 PM
Thanks very much Vortex.

Appreciate the testing feedback.

John Z
Title: Re: Simple Calendar
Post by: Marco on February 23, 2025, 10:05:27 AM
Hi John,

Very nice application and works well on Windows 10/11. One small suggestion. If you click the "+/-" button without first clicking the "Save as Start" button, the end date is wrong. I can think of two possible solutions: 1- Warn the user to click the "Save as Start" button first, or 2- Automatically select the current date as the start date.
However, this is just a suggestion. The application can be really useful in various circumstances. Thanks.
Title: Re: Simple Calendar
Post by: John Z on February 23, 2025, 09:16:04 PM
Hi Marco,

Thanks very much for catching that.  I appreciate you testing it and providing feedback.
Oversight on my part - just didn't think of it :(

Modified the program to make the +/- only active after using 'Save as Start' similar to the Schedule and Days buttons.  Makes sense.

Updated help file as well.

Thanks again, new version replaced the old in the initial post.

John Z
Title: Re: Simple Calendar
Post by: TimoVJL on February 24, 2025, 03:08:30 PM
MS Calendar component (DATETIMEPICK_CLASS) is good for many purboses.

For example, when user needs easy way to select date for program to select data from some periods.
The periods doesn't mean women periods  ;)
Title: Re: Simple Calendar
Post by: John Z on February 24, 2025, 09:11:37 PM
Yup, and it is also very good to use to get consistent date-time inputs for any program that will be used internationally.  Relieves somewhat the issues of locale specific date formats, which can vary the sequencing of months and days (years are easy). 

John Z
Title: Re: Simple Calendar
Post by: Quin on April 29, 2025, 05:01:29 PM
Hi John,
Thanks for this! Your program works well on Windows 10 and 11 IoT lTSC with my screen reader, NVDA. I do have some feedback though:
1. The text fields in your dialogs aren't labeled. I see the text label if I explore the screen, but if I press tab to focus the text field the label isn't read. The way I typically pull this off is by positioning the text right above/below the control, but you can also set an accessible label using the IAccessible interface.
2. The calendar control with a keyboard is a bit...awkward. I can go by one second intervals with the up and down arrow keys, but that's about all I've been able to figure out. Is it possible for this to be improved?
Overall an incredibly solid program, well done! I especially love the CHM help file :)
Title: Re: Simple Calendar
Post by: John Z on April 29, 2025, 10:40:06 PM
Hi Quin,

for #1 I've download NVDA to 'see' what you mean. The only dialog for text entry is the scheduler asking for a note to show when the schedule is met.  There is a Label above it.  The issue might be that I never include labels in the tab sequencing?  In any case I'll try NVDA.

for #2 I think you are referring to the schedule time input, if you tab to it, it starts in the hours field and hours can be typed in, then use a right arrow key to move to the minutes, then right arrow key to move to seconds, finally right arrow key to the AM/PM.  Left arrow key will move the other way towards hours.  The arrow key use is circular so left on hours goes to AM/PM.  Hopefully this helps for that part.  Every part can be typed in or changed using the UP/Down arrows.  I could do better explaining this in the help file too (I used two pictures but not much explanation).

I checked out IAccessible om the Microsoft web site unfortunately the interface seems to be C++.  That is way far beyond my capability. 

Thanks for trying it out and providing useful feedback!  I'll see if I can understand how to improve label reading for inputs after using NVDA.

John Z
Title: Re: Simple Calendar
Post by: TimoVJL on April 30, 2025, 01:42:04 AM
Quote from: John Z on April 29, 2025, 10:40:06 PMI checked out IAccessible om the Microsoft web site unfortunately the interface seems to be C++.  That is way far beyond my capability. 

John Z
OleAcc.h have C interface too, if it's same thing.
Title: Re: Simple Calendar
Post by: John Z on April 30, 2025, 12:50:11 PM
Quote from: TimoVJL on April 30, 2025, 01:42:04 AMOleAcc.h have C interface too, if it's same thing.

You are right, it is.  Thanks, I'll look around for an example of how to implement the C version.
it looks like a big, perhaps complex, job -

John z
Title: Re: Simple Calendar
Post by: TimoVJL on April 30, 2025, 01:45:28 PM
https://github.com/roukaour/TTSApp (https://github.com/roukaour/TTSApp)
A C++ example
Title: Re: Simple Calendar
Post by: John Z on April 30, 2025, 04:46:58 PM
Hi Quin,

I have installed the NVDA program and run it with the calendar program.  For the most part it reads everything well. 

I think there are two issues.  When Schedule is clicked the confirm dialog is opened. It is read ok BUT the first TAB location is the Confirm button rather than the text edit field, then to get to the text edit field (which is read out as an edit field) tab needs to be pressed twice.  If the Edit field was the first TAB position then the reader would read the preceding label then identify the edit field.  I'll edit the program to try/verify that.

The other edit box for the +/- number of days has the 1st tab location as the edit box and seems to be read out as expected, pausing in the edit box, so I think changing the other will work too.

The other issue which I can't explain is NVDA always seems to be speaking the wrong calendar date - very strange.  I don't understand why.

John Z
Title: Re: Simple Calendar
Post by: Quin on April 30, 2025, 04:51:29 PM
Hi John Z,
Thanks for your dedication to making this better for blind users!
NVDA reading the wrong date is indeed quite strange, my personal recommendation would be to write a minimal C program that shows the behavior, and send it as a bug report to NV Access, if it is NVDA specific. TO test, try activating Narrator with Control+Windows+Enter and having it read your app. Narrator isn't a very good or widely used screen reader, but it'll show us if its NVDA or not.
Thanks again!
Title: Re: Simple Calendar
Post by: John Z on July 11, 2026, 08:28:14 AM
No biggy - just something to do...

Here is version 2.0 of the simple calendar program.  The calendar program now is also the alert program, meaning no longer is there an Alert.exe used to notify that a scheduled item is due.  Version 2.0 supports four 'Methods' to schedule an alert; VBS, PowerShell 5.1, C, and PowerShell 7.  The 'Method' to use can be selected, but defaults to C if no selection is made.  An ini file has been added to store the 'Method' chosen.

The help file has been updated.

Old sources removed to save space, new version posted on page 2

As the original, it can be run from a USB, just three files, nothing written to the registry, no phone home or telemetry.  Simple calendar with a few 'extras' thrown in...

John Z

All sources are in calendar_V2a_sources.ZIP
Just the calendar.exe and the help file calendar.chm are in calendar_v2a_exe.7z
Title: Re: Simple Calendar
Post by: Marco on July 11, 2026, 10:23:35 AM
Hi John,

Thank you for this update!

I tested the program on a PC without PowerShell 7 installed. When I click the 'Settings' button, the 'Use PowerShell 7' option is correctly disabled. After closing the program, as a test, I manually opened the 'zcalendar.ini' file and set the 'Method' key to 4. When I reopen the program and then the 'Choose method' dialog box, the 'Use PowerShell 7' option is both disabled and selected. In fact, when I then try to create a task, at the confirmation stage, the program naturally displays the 'Failed CreateProcess' error window with the message
"C:\Program Files\PowerShell\7\pwsh.exe" -WindowStyle Hidden -FILE "R:\Temp\calendar_exe\SCR1.PS1"

This is a deliberately unusual test scenario, but I simulated having subsequently uninstalled PowerShell 7 after setting it as the default task creation method in the program.

Marco
Title: Re: Simple Calendar
Post by: John Z on July 11, 2026, 10:53:33 PM
Thanks Marco!

I really appreciate you taking the time and providing testing feedback.👍👍👍

From your test I should deselect PowerShell 7 in Choice Dialog and default back to C, I think that will correct the 'selected but disabled situation'.  Great test.

I also added checks in a few other places too just in case you really go wild  ;D , and improved messaging text. 

Nice to think outside the box!  Thanks again.

Version 2.0.1 attached.

John Z

P.S. I was testing PowerShell 7 absence just by renaming pwsh.exe - much easier than uninstall.

Update 7/17 removed attachment to conserve space.  Newer sources 2.0.2 attached further down.
Title: Re: Simple Calendar
Post by: Marco on July 13, 2026, 11:45:01 AM
Hi John,

I'm glad you found my feedback helpful. The issue has been fixed! During my testing, I found that I missed a 'Set current time' button. I think it would be helpful to have a way to reset the start time to the current time, which would be consistent with the "button" that sets the current date. Anyway, this is just a small suggestion.

Marco
Title: Re: Simple Calendar
Post by: John Z on July 14, 2026, 09:33:43 PM
Hi Marco,

Thanks for the feedback.  I'll look into adding a button (no guarantees though).
I'm in the middle of the next thing though, so it might be a bit for enhancement, as well as now testing the new 14.5  :)

John Z
Title: Re: Simple Calendar
Post by: Marco on July 15, 2026, 09:51:24 AM
Hi John,

QuoteI'll look into adding a button (no guarantees though).
Thank you for taking this into consideration. As I said, it's just a small suggestion. I like consistency in software. But this is just a personal preference.

Quoteas well as now testing the new 14.5  :)
Yep, me too  :)

Marco
Title: Re: Simple Calendar
Post by: John Z on July 17, 2026, 11:32:49 PM
Hi Marco,

Here is a version 2.0.2 that enables setting the Alert time to the current system time.  It does so without using a button, as I don't think it would be used very much, and space is limited without a significant GUI change.  The Alert time is not meant to be another system time clock. I suppose I could 'disable' scheduling unless the Alert time was changed but that seems burdensome to a user.

Right click in any open area of the controls line to set the Alert time to the current system time. 

So this may be an interim, or final solution, as I think on it more (after the next big thing  ;) )

I hope you don't mind that I acknowledge your assistance in the help file.

Thanks,
John Z

Full project sources zip attached. Also attached 7z which is just the program and help file for those that don't want/need the sources.
Title: Re: Simple Calendar
Post by: Marco on July 19, 2026, 10:22:53 AM
Hi John,

QuoteRight click in any open area of the controls line to set the Alert time to the current system time.
Thank you for taking the time to implement this feature.

QuoteI hope you don't mind that I acknowledge your assistance in the help file.
No problem at all! In fact, thank you. I do the same when a user reports a bug to me regarding WinContig.

Marco