Presenting Sandstorm’s Calendar (sscal) Class
*** I moved to my own blog site so to check on my future posts, please go to www.junblogs.com ***
The other day, I started playing with one of my old programs to implement the switchbox class I recently created as I wanted to see how it will look in an actual application that is being utilized. So I opened my ErgoX and started toying with the GUI. In the process though, it looks like that my old GUI on the main form itself is not that satisfying anymore to me. So I moved objects around (
"Really? It is VFP?") and then later as I really cannot find the "feel" of it, I decided to remove some objects and add others I recently toyed with like an RTF control. Then my eyes fell on the monthview activex and then my "spider sense" begins to tingle.
What if, I mused to myself, I replace that with something like the calendar of a side bar now famous in XP, Vista and Seven? And so I begin to toy with the GUI for a calendar. And that is a pure image with just the labels for the dates I slapped on top of it. Satisfied, I again said to myself, what if I put skinning ability into it? So I created 4 more skins for that. Again loving what I am seeing and done so far, I thought, "Whatdaheck? Let's make this a class so others can benefit from this too!" And so the initial sscal class is born with the ability of the user to choose color.

Yesterday afternoon though, after a long talk with a friend, I again thought since I am satisfied with the sscal class appearance, why not also add an inner calendar like the sidebar style? Pooop there goes the inner calendar! Sounds easy eh? LOL! It is not but it is done. Needless to say, the very simple need of an image for a calendar became the class I am sharing now because of a lots of why nots!

Like the switchbox class, choosing the color is done in the init event of the class' instance like this:
t
his._color = "blue"
Colors are blue, orange, yellow, green and red. So if you want to change the calendar into a red one in your form just put in its init:
this._color = "red"
And that is it! Drag into your form, assign a color and smile.
Interaction:When you double-click the cover, the inner one will be revealed where you can then change a date by clicking on a number or moving forward or backward months via clicking the arrows. Double clicking it again returns to the cover with your latest date selection. The calendar (inner and the cover) will be repainted properly to your current date selection.


Getting current sscal date value is easy as this:
?thisform.sscal1._dclicked
Bonus: A running clock is everpresent in the cover. Two birds in one stone eh?
Additional Bonus: It does not need ANYTHING outside of the VFP box.
This is 100% native VFP.Last final bonus: It is my habit to hardcode path as I like to see what is happening in any of my classes even in the development stage. But that habit would require some more work on the part of the recipient of my class. Anyway, the reason why I am providing open sources is basically I just wanted to share my ideas to anybody interested and for them to learn additional ways how certain things can be done. Also with the source codes included, others can extend any of those based on what they desire.
From this moment however, I am removing the hardcoded path so the class can be easily used on your end without the need of path alteration anymore. Just include this class in your project and use it without any change.
Caveat: you will not see the images though on the development stage as those will appear only on the exe (plus you need to manually add the images I used, in your own project).
Update: December 26, 2009I already have submitted the classes for free and easy download to Eric for the download section of foxite, so you will see those pending the decision of Eric. In addition, I have created a thread in coderisland to have the same available for download. Please click on the link below:http://www.coderisland.com/forum/viewtopic.php?f=10&t=254