Calendar Year Navigation
Contributed by Paul Rito
The PFC calendar object provides previous & next month buttons, but none for years. Just changing a year up or down requires 12 mouse clicks or the user must close the calendar and manually enter the year.
This extension to u_calendar adds datawindow objects, scripts and overloaded functions to add previous and next year buttons.
In the constructor script, two new buttons are dynamically added to the dw_cal control d_calendar object: prevyear "<<" and nextyear ">>". Also, the st_month heading is moved and shrunk to accomodate the new buttons.
The of_DrawMonth() function is overloaded, first invoking its ancestor, then setting st_month to the 3 character month abbreviation + 4 digit year ("mmm yyyy").
A new event, pfc_incryear(ai_delta) is added to process the year change, either up or down depending on the parameter. This event uses a pfc Date Service function to set the new date (In stark contract to the PFC events pfc_prevmonth & pfc_nextmonth which, to my wonderment, use brute force and 10 more lines of code [each + a completely uncessary extra event] to accomplish the same task. Wonder why the pfc has grown so much? Sorry, couldn't ignore the opportunity for commentary.)
The buttonclicked script is extended to invoke the pfc_incryear event with a +/- 1 depending on the button clicked.
The u_calendar object is included in pfc_cal.pbl. Copy the object or add the scripts to the u_calendar object in pfe_main.pbl.
Note that the scripts dynamically modify d_calendar (from pfc_main) and won't necessarily work in future versions. This was done to avoid modifing the d_calendar object in pfc_main, or creating yet another pfc object. With hope, Sybase will add the functionality and obviate the need for this extension (feel free to use this).
|Download the||About the extension contributor|
|10/03/1998||Initial Revision||Ver. 1.00|
Interested in contributing material to this web site? Send an email to firstname.lastname@example.org, but don't forget to check the contribution guidelines first.
For information or suggestions about this web site please contact email@example.com
sponsored by Dynamic Technology Group.
The information on this site is provided for advice only and not to be considered a contract or a liability against Dynamic Technology Group.