This mixin class is used to assist the user when editing date fields from within your VDF application.
It's features are:
- The code makes it possible for the user to insert a day and month and when navigating out of the control, the current year will be automatically added to the field.
- A 2-digits year will be converted to 4 digit year.
- If no date has been entered then the current date will be inserted. This feature is optionally as it can disabled by by setting the property
AllowBlankDate to True.
The code has defined the following shortcutkeys to be added to your date controls:
| Keys || Functionality |
<PGUP> or <PGDOWN>
| Increase/decrease the date by 1 day |
| Change the date in the control to the current date |
| Popup a date selection dialog. The calender used here is from Sture Andersens VDFQuery.|
| Increase the date by a week |
| Decrease the date by a week |
| Increase the date by a month |
| Decrease the date by a month |
The notes below are only meant to help you when installing the code to the workspace of your application.
There are more ways to do this
Included in the download are 2 subclasses (cWsForm.pkg and cWsdbForm.pkg) that use our mixinclass only to show you how you can add the mixin package to your own subclass layer.
The associated cWsForm.dfc and cWsdbForm.dfc files show how to make the property pbAllowBlankDate visible in the properties dialog inside the IDE.
Some quick steps to get you going.
- Copy the .bmp, .dfc, .dfo files in the zipfile to the IdeSrc folder of your workspace
- Copy all the .pkg files to your AppSrc folder
- Go to 'maintain classlists' in your VDF IDE/Studio
- Select the workspace tabpage and add the new controls cWsForm and cWsdbForm
- Open a view in your application that you want to use the control with and switch the view into full source mode
- Change the standard dbForm control in your application that is used to enter dates from "Object oFoo is a dbForm" into "Object oFoo is a cWsdbForm"
- Switch the view back into normal mode and make a minimal change (for ex. add a space character) to have the IDE/Studio write the extra line into the source that includes the new subclass and save your change.
- Compile, test and enjoy!