Skip to content

Commit

Permalink
New SetCalendars() method.
Browse files Browse the repository at this point in the history
Meridian selectors now transparent.
Icons8 licensing.
  • Loading branch information
atlopes committed Sep 17, 2018
1 parent 9ce77c2 commit 0c03fd4
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 13 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -10,7 +10,7 @@ A VFP set of classes to hold calendrical information, and perform simple calcula

## Using ##

* See [UNLICENSE](UNLICENSE.md).
* See [UNLICENSE](UNLICENSE.md). Icons in the DatePicker Visual Library, by [Icons8](https://icons8.com "Icons8"), are licensed under an [Attribution-NoDerivs 3.0 Unported](https://creativecommons.org/licenses/by-nd/3.0/) (CC BY-ND 3.0) license by their authors.
* In a project, include Calendar.prg (the base class) and any other specific classes that an application may require (for instance, ``gregorian-calendar.prg``, ``hebrew-calendar.prg``).
* To make available a class definition, DO its program (for instance, `DO persian-calendar.prg`)
* Create an object, and use it (see [DOCUMENTATION](DOCUMENTATION.md) for more info).
Expand Down
5 changes: 1 addition & 4 deletions datepicker.md
Expand Up @@ -44,17 +44,14 @@ CalendarCalc classes may be used for calendar visualization, instead of or in ad

The CalendarCalc classes are set in the `.Calendars` property of the target control, which must point to a Collection of CalendarCalc classes, keyed by some name that will allow their identification in a menu.

For instance, to prepare a date picker with Jewish calendar, in addition to VFP's system calendar, place on the `Init()` of the target control,
For instance, to prepare a date picker with Jewish calendar, in addition to VFP's system calendar, place on the `SetCalendars()` method of the target control,

```foxpro
DO LOCFILE("hebrew-calendar.prg")
This.Calendars = CREATEOBJECT("Collection")
This.Calendars.Add(CREATEOBJECT("HebrewCalendar"), "Hebrew")
* DO NOT FORGET!
DODEFAULT()
```

Other required calendars will just have to be added to the collection. Note that the calendars Collection and its members do not have to be created in every instance of the target control: it may be a form property or some object that is in scope, for instance.
Expand Down
14 changes: 12 additions & 2 deletions datepicker.vc2
Expand Up @@ -405,11 +405,13 @@ DEFINE CLASS formdatepicker AS form

ADD OBJECT 'pgfViews.pagHours.opgMeridian' AS optiongroup WITH ;
AutoSize = .T., ;
BackStyle = 0, ;
ButtonCount = 2, ;
Left = 56, ;
Name = "opgMeridian", ;
Top = 164, ;
Option1.AutoSize = .T., ;
Option1.BackStyle = 0, ;
Option1.Caption = "AM", ;
Option1.FontName = "Segoe UI", ;
Option1.Height = 17, ;
Expand All @@ -418,6 +420,7 @@ DEFINE CLASS formdatepicker AS form
Option1.Top = 5, ;
Option1.Width = 37, ;
Option2.AutoSize = .T., ;
Option2.BackStyle = 0, ;
Option2.Caption = "PM", ;
Option2.FontName = "Segoe UI", ;
Option2.Height = 17, ;
Expand Down Expand Up @@ -2073,13 +2076,14 @@ DEFINE CLASS textdatepicker AS textbox

*<DefinedPropArrayMethod>
*m: dpopen && Opens a date picker window.
*m: setcalendars && Set calendars collection.
*p: calendarindex && The calendar from the calendars collection that will be used to pick a date.
*p: calendars && Collection of alternative calendars.
*p: dpform
*p: dpswitch && Control to switch to the date picker form.
*p: isdatetime && Signals if time should be input, also.
*p: nosystemcalendar && If set, do not use the system calendar.
*p: _memberdata
*p: _memberdata && XML Metadata for customizable properties
*</DefinedPropArrayMethod>

Alignment = 3
Expand All @@ -2099,7 +2103,8 @@ DEFINE CLASS textdatepicker AS textbox
<memberdata name="calendars" type="property" display="Calendars"/>
<memberdata name="calendarindex" type="property" display="CalendarIndex"/>
<memberdata name="nosystemcalendar" type="property" display="NoSystemCalendar"/>
</VFPData>
<memberdata name="setcalendars" type="method" display="SetCalendars"/>
</VFPData> && XML Metadata for customizable properties

PROCEDURE DblClick
This.DPOpen()
Expand Down Expand Up @@ -2177,6 +2182,11 @@ DEFINE CLASS textdatepicker AS textbox

BINDEVENT(This.DPSwitch, "Click", This, "DPOpen")

This.SetCalendars()

ENDPROC

PROCEDURE setcalendars && Set calendars collection.
ENDPROC

ENDDEFINE
Binary file modified datepicker.vct
Binary file not shown.
Binary file modified datepicker.vcx
Binary file not shown.
Binary file modified datepicker.zip
Binary file not shown.
8 changes: 2 additions & 6 deletions examples/datepicker.sc2
Expand Up @@ -228,7 +228,7 @@ DEFINE CLASS form1 AS form

ENDPROC

PROCEDURE Textdatepicker3.Init
PROCEDURE Textdatepicker3.setcalendars
DO LOCFILE("hebrew-calendar.prg")
DO LOCFILE("islamic-calendar.prg")
DO LOCFILE("persian-calendar.prg")
Expand All @@ -239,11 +239,9 @@ DEFINE CLASS form1 AS form
This.Calendars.Add(CREATEOBJECT("IslamicCalendar"), "Islamic")
This.Calendars.Add(CREATEOBJECT("PersianCalendar"), "Persian")

* DO NOT FORGET!
DODEFAULT()
ENDPROC

PROCEDURE Textdatepicker4.Init
PROCEDURE Textdatepicker4.setcalendars
DO LOCFILE("us-calendar-events.prg")

This.Calendars = CREATEOBJECT("Collection")
Expand All @@ -258,8 +256,6 @@ DEFINE CLASS form1 AS form
This.CalendarIndex = 1
This.NoSystemCalendar = .T.

* DO NOT FORGET!
DODEFAULT()
ENDPROC

ENDDEFINE
Binary file modified examples/datepicker.sct
Binary file not shown.
Binary file modified examples/datepicker.scx
Binary file not shown.

0 comments on commit 0c03fd4

Please sign in to comment.