Click here to Skip to main content
15,880,392 members
Articles / Desktop Programming / MFC
Article

BCGDateTime controls version 1.0

Rate me:
Please Sign up or sign in to vote.
4.63/5 (8 votes)
26 Jan 2000 108.3K   3K   42   13
A set of four date/time ActiveX controls (Date/Time Picker, Month Calendar, Duration Control, Time Intervals Control)
  • Download BCGDateTime controls - 244 Kb
  • Image 1

    Please see Stas Levin's Page for the latest updates, discussion board, and FAQ.

    Introduction

    BCGDateTime is a set of four date/time ActiveX controls (Date/Time Picker, Month Calendar, Duration Control, Time Intervals Control)

    BCGDateTime Features

    BCGDateTime is a set of four ActiveX date/time and calendar controls.

    • Date/Time Picker allows you enter date/time together in the one control;
    • Month Calendar allows create your own organizers with single/multiply day selection both in weekly and monthly mode, mark several days, enable specific time interval;
    • Duration Control allows you edit an event duration such as "3 days 10 hours 15 minutes". Fully configurable!
    • Time Intervals Control  allows you define some daily time intervals such as 10:00AM-10:20AM, 3PM-5:30PM

    All controls are automatically obtain date/time system formats from the customer computer settings.

    How to use BCGDateTime controls

    Installation notes:

    1. Unzip BCGTimeControls.zip file (e.g. c:\bcg directory)
    2. Go to output\release directory and register all controls (regsvr32 BCGDateTime.ocx, regsvr32 BCGDurationCtrl.ocx and regsvr32 BCGTimeIntervals.ocx)
    3. Run BCGTimeExample.exe

    Date/Time Control Properties and Methods:

    NameDescription
    Date DateDate/Time value
    DATE MinDateMin. allowed date
    DATE MaxDateMax. allowed date
    boolean CheckButtonShow check box
    boolean DropCalendarShow Drop-down calendar arrow
    boolean ShowDateShow control's date part
    boolean ShowTimeShow control's time part
    boolean SpinButtonShow up/down arrows
    boolean WantReturnIf WantReturn is true, control catches ENTER/ESC keys and fires OnEnter/OnCancel events
    void SizeToContent()Adjust control size according to attributes. Should be called in OnInitDialog (VB - Form_Load)

    Date/Time Control Events:

    Name Description
    OnDateChangedIndicates that Date property was changed
    OnSetFocusIndicates that control received focus
    OnKillFocusIndicates that control lost focus
    OnEnterEnter key was pressed (fired if WantReturn property is true)
    OnCancelEsc key was pressed (fired if WantReturn property is true)

    Calendar Control Properties and Methods:

    Name Description
    boolean MultiplySelectionAllow multiply days selection
    boolean AbsoluteSelectionModeWhen this property is true, the selected days are saved when user changes the month; otherwise, control saves the weekdays
    OLE_COLOR BackgroundColorCalendar background color
    OLE_COLOR ForegroundColorCalendar foreground color
    OLE_COLOR SelectionBackgroundColorBackground color of the selected days
    OLE_COLOR SelectionForegroundColorForeground color of the selected days
    OLE_COLOR LightColor3-d edges light color
    OLE_COLOR ShadowColor3-d edges shadow color
    void SetSelectedDay(short iDay)Select the day (1-31)
    void ClearAllSelections()Clear all day selections
    boolean IsDaySelected(short iDay)Is day (1-31) selected?
    boolean MarkDay(short iDayNum, boolean bMarked)Mark the specific day (marked day is displayed as bold+underline)
    void UnMarkAllDays()Clear all day marks

    Calendar Control Events:

    Name Description
    OnSelectionChanged Indicates that selection was changed
    OnDateChangedIndicates that date was changed (relevant if MultiplySelection property is false)
    OnMonthChangedIndicates that month/year was changes

    Duration Control Properties and Methods:

    Name Description
    long TotalSecondsDuration
    boolean SpinButtonShow up/down arrows
    BSTR DaysLabelText appeares after the days number (default: "Day(s) ")
    BSTR HoursLabelText appeares after the hours number (default: ":")
    BSTR MinutesLabelText appeares after the minutes number (default is empty)
    boolean ShowDaysShow number of days
    boolean ShowHoursMinutesShow hours/minutes part
    void SizeToContent()Adjust control size according to attributes. Should be called in OnInitDialog (VB - Form_Load)

    Duration Control Events:

    Name Description
    void OnDurationChanged(long lTotalSeconds)Indicates that duration was changed

    Time Intervals Control Properties and Methods:

    Name Description
    boolean MergingIsAllowedTime intervals automerge is allowed
    boolean MultiplySelectionMultiple selection is allowed
    OLE_COLOR IntervalColorInterval background color
    OLE_COLOR IntervalTextColorInterval foreground color
    OLE_COLOR BackgroundColorControl background color
    OLE_COLOR ForegroundColorControl foreground color
    boolean AddInterval(DATE dateFrom, DATE dateTo, short iStatus)Add a new time interval (remark: date part of DATE-type parameters are ignored). Interval's color will be defined according to interval's status (see SetStatusColor method)
    boolean ChangeInterval(short iIndex, DATE dateFrom, DATE dateTo, short iStatus)Changes the specific time interval
    boolean RemoveInterval(short index)Remove the specific time interval
    void RemoveAllIntervals()Remove all time intervals
    short GetIntervalsCount()Returns intervals count
    boolean GetInterval(short iIndex, DATE* dateFrom, DATE* dateTo, short* iStatus)Obtain the specific interval data
    boolean SetIntervalStatus(short iIndex, short iStatus)Set the specific interval status. Interval's color will be defined according to interval's status (see SetStatusColor method)
    void SetStatusColor(short iStatus, OLE_COLOR color)Set the specific status's color. All time intervals with the given status will be drawn with this background color
    short GetCurSel()Returns selected interval number or (-1) if no intervals is selected
    boolean SetCurSel(short index)Select the specific interval

    Time Intervals Control Events:

    Name Description
    OnAddInterval(short index, DATE FromTime, DATE ToTime)New time interval was added by user
    OnChangeInterval(short index, DATE FromTime, DATE ToTime)Time interval was moved by user
    OnRemoveInterval(DATE FromTime, DATE ToTime)Time interval was removed by user
    OnSelectionChanged(short index)Selection was changed

    Requirements

    MS Visual C++ 5.0 with the SP3   This code can be used WITHOUT ANY WARRANTIES on your own risk. You can send bug reports and suggestions to Stas Levin.

    Copyright and use

    BCGDateTime controls are freeware software. You may use, compile or redistribute it as part of your application for free. You cannot redistribute it as a part of a software development library without the agreement of the author. If the sources are distributed along with the application, you should leave the original copyright notes in the source code without any changes.

    License

    This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

    A list of licenses authors might use can be found here


    Written By
    Web Developer
    Russian Federation Russian Federation
    This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

    Comments and Discussions

     
    GeneralMy vote of 5 Pin
    Volynsky Alex19-May-12 8:04
    professionalVolynsky Alex19-May-12 8:04 
    GeneralMy vote of 5 Pin
    Alan P Brown13-Jun-11 22:23
    Alan P Brown13-Jun-11 22:23 
    AnswerVery usefull controls ... ! Pin
    LeoBro29-Aug-08 3:53
    LeoBro29-Aug-08 3:53 
    GeneralArabic Hejri date Pin
    Ibrahim Hamoud23-Jul-07 12:40
    Ibrahim Hamoud23-Jul-07 12:40 
    GeneralChanging the background color of the date time picker control Pin
    gdsumit27-Sep-06 3:50
    gdsumit27-Sep-06 3:50 
    GeneralChange language in control Pin
    TweedleMB22-Oct-05 9:48
    TweedleMB22-Oct-05 9:48 
    GeneralRe: Change language in control Pin
    jabulino11-Jan-06 1:13
    jabulino11-Jan-06 1:13 
    Generalsame problem Pin
    vikas amin24-Aug-05 3:17
    vikas amin24-Aug-05 3:17 
    Generali met troubles Pin
    ghain4ghada6-Jun-04 21:03
    ghain4ghada6-Jun-04 21:03 
    GeneralGreat Controls! ;-))) Only a small bugfix... Pin
    LeaetherStrip24-Dec-03 21:14
    LeaetherStrip24-Dec-03 21:14 
    QuestionWith BCG Property List? Pin
    Make-Marker6-Aug-03 22:54
    sussMake-Marker6-Aug-03 22:54 
    GeneralRegistring control Pin
    europebeat5-Oct-02 10:13
    europebeat5-Oct-02 10:13 
    GeneralRe: Registring control Pin
    Drew Hall16-Jul-03 4:44
    Drew Hall16-Jul-03 4:44 

    General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

    Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.