BCG Time Controls

Environment: MS Visual C++ 5.0 with the SP3  

Set of four time ActiveX controls:

  • Date/Time Picker
  • Month Calendar
  • Duration Control
  • Time Intervals Control

Installation notes:

  1. Unzip 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:

Name Description
Date Date Date/Time value
DATE MinDate Min. allowed date
DATE MaxDate Max. allowed date
boolean CheckButton Show check box
boolean DropCalendar Show Drop-down calendar arrow
boolean ShowDate Show control's date part
boolean ShowTime Show control's time part
boolean SpinButton Show up/down arrows
boolean WantReturn If 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
OnDateChanged Indicates that Date property was changed
OnSetFocus Indicates that control received focus
OnKillFocus Indicates that control lost focus
OnEnter Enter key was pressed (fired if WantReturn property is true)
OnCancel Esc key was pressed (fired if WantReturn property is true)

Calendar Control Properties and Methods:

Name Description
boolean MultiplySelection Allow multiply days selection
boolean AbsoluteSelectionMode When this property is true, the selected days are saved when user changes the month; otherwise, control saves the weekdays
OLE_COLOR BackgroundColor Calendar background color
OLE_COLOR ForegroundColor Calendar foreground color
OLE_COLOR SelectionBackgroundColor Background color of the selected days
OLE_COLOR SelectionForegroundColor Foreground color of the selected days
OLE_COLOR LightColor 3-d edges light color
OLE_COLOR ShadowColor 3-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
OnDateChanged Indicates that date was changed (relevant if MultiplySelection property is false)
OnMonthChanged Indicates that month/year was changes

Duration Control Properties and Methods:

Name Description
long TotalSeconds Duration
boolean SpinButton Show up/down arrows
BSTR DaysLabel Text appeares after the days number (default: "Day(s) ")
BSTR HoursLabel Text appeares after the hours number (default: ":")
BSTR MinutesLabel Text appeares after the minutes number (default is empty)
boolean ShowDays Show number of days
boolean ShowHoursMinutes Show 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 MergingIsAllowed Time intervals automerge is allowed
boolean MultiplySelection Multiple selection is allowed
OLE_COLOR IntervalColor Interval background color
OLE_COLOR IntervalTextColor Interval foreground color
OLE_COLOR BackgroundColor Control background color
OLE_COLOR ForegroundColor Control 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


These controls are freeware. You can use them in any application. You can't use this code in software development library and/or redistribute the source code without author's permission. This code can be used WITHOUT ANY WARRANTIES on your own risk. You can send bug reports and suggestions to Stas Levin.

 Download Source Code and Example



  • vb version

    Posted by Legacy on 10/13/2003 12:00am

    Originally posted by: gorav bhootra

    is it possible to have a vb version of fully working activex control (ocx + dll)???

    will be of much help.

    thanx in advance.

  • Can't move Interval up from bottom 12AM

    Posted by Legacy on 01/16/2003 12:00am

    Originally posted by: Veeder

    If you place a time interval which ends at the bottom (12AM), you will be unable to drag the bottom of the interval up and shorten its length.

    Anyone look into how to fix this?

  • Date restricted calendar

    Posted by Legacy on 09/16/2002 12:00am

    Originally posted by: Saravanan

    Excellent.Very usefull.Easy to use.Many thanks to the stas.

  • Button Click Problem

    Posted by Legacy on 04/24/2002 12:00am

    Originally posted by: Johnny Kim

    I use BCGDateTime control and normal button control.
    but When BCGDateTime control has focus, and I click the
    button then the button is not clicked by one click.

    only the button is focused and after then click once more
    then that is clicked.

    Did someone correct this problem , Send me new source please.

  • More info from control?

    Posted by Legacy on 02/01/2002 12:00am

    Originally posted by: Tim Manchester


    I was wondering what would need to be done to change this control so that it saved the dates as an absolute date (month, day and year) which didn't carry over from month to month? Would this be difficult/impossible/easy?


    -Tim Manchester

  • BCG Controls

    Posted by Legacy on 12/20/2001 12:00am

    Originally posted by: Lory

    Can we use it as a regular conrol ? instead of activex

  • The duration control hangs up when typed fast

    Posted by Legacy on 12/19/2001 12:00am

    Originally posted by: Dinesh

    The duration control hangs up ( the UI freezes ) when you type the digits for hours or minutes at a fast rate. When I try the same with the MS date time picker, it does not hang up. It would be nice if you could fix this problem.

  • How to protect the Interval control from being changed?

    Posted by Legacy on 12/14/2001 12:00am

    Originally posted by: Olstar

    I want to have a certain mode in my app when the user is not allowed to change or delete an interval. Do you have this feature implemented. If not - please recommend me a quick fix for the ActiveX...

  • Is this freeware

    Posted by Legacy on 11/12/2001 12:00am

    Originally posted by: Henrik Rasmussen

    I tried this code and it works wonderfully, but then I saw the same code from and now I am wondering, is this really freeware, that I can use in my app?

  • TimeInterval Overlap

    Posted by Legacy on 01/16/2001 12:00am

    Originally posted by: Steven

    If the user sets the control from 12am-12am (all day), if you click just above the 12:00 am at the top, you can drag an overlapping interval over the current one. Same at the bottom.

  • Loading, Please Wait ...

Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • On-demand Event Event Date: November 17, 2015 Although enterprise adoption of open source has accelerated, some are still wary of it. But not all open source technologies are the same: some are designed with enterprises in mind. In this webinar, we'll discuss trends in open source development, innovation impacts, and what it means for the future.

  • Moving from an on-premises environment to Office 365 does not remove the need to plan for disruptions or reduce the business risk requirements for protecting email services. If anything, some risks increase with a move to the cloud. Read how to ease the transition every business faces if considering or already migrating to cloud email. This white paper discusses: Setting expectations when migrating to Office 365 Understanding the implications of relying solely on Exchange Online security Necessary archiving …

Most Popular Programming Stories

More for Developers

RSS Feeds

Thanks for your registration, follow us on our social networks to keep up-to-date