# Xojo Calendar / Time Picker - Question

**URL:** <https://forum.xojo.com/t/xojo-calendar-time-picker-question/16232>\
**Category:** Extras\
**Created:** [May 3, 2014, 9:42pm UTC](https://forum.xojo.com/t/xojo-calendar-time-picker-question/16232 "2014-05-03T21:42:13Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jim\_Smith](https://forum.xojo.com/letter_avatar_proxy/v4/letter/j/edb3f5/32.png) [@Jim\_Smith](https://forum.xojo.com/u/Jim_Smith)\
**Post date:** [May 3, 2014, 9:42pm UTC](https://forum.xojo.com/t/xojo-calendar-time-picker-question/16232/1 "2014-05-03T21:42:13Z")

</div>

Thought I would start a new conversation on this as the original is getting kind of long.

I guess I’m just an old Low Level Assembler Language programmer who has always had a difficult time with higher level program language.

Anyway; I just don’t get it. How do I use this thing in my application?

Let say I have a field (control?) in a window that have a date and time of an event that need to be changed.

I do see that I need to set parameters like both date and clock need to be shown, and others. And I need to add an Event to set the selected date and time in field-control (mention above).

However as I do not know what the control-type for the field is I’m at a loss.

Any help will be appreciated.

I might mention I have already extracted the TimePicker and Time\_Container and using it, so I do understand it a little.

---

<div class="post-metadata">

**Author:** ![Mike\_Cotrone](https://forum.xojo.com/user_avatar/forum.xojo.com/mike_cotrone/32/19940_2.png) [@Mike\_Cotrone](https://forum.xojo.com/u/Mike_Cotrone)\
**Post date:** [May 3, 2014, 10:47pm UTC](https://forum.xojo.com/t/xojo-calendar-time-picker-question/16232/2 "2014-05-03T22:47:22Z")

</div>

James this has sparked me to make formal documentation for this tool. I will begin that next week. In the mean time Please see the following ASCII flow chart (top down). I designed this tool using the principles of Object Oriented Programming (encapsulation). This post may also become a work in progress as I re-read it later 🙂

First Level:  
This is the DemoLaunchWindow that does two main things. 1. It sets the options that you want for the demo and 2. it dynamically instantiates the “DateTimeWindow”. This is done by the MyPicker computed property under DemoLaunchWindow. Ie. In another app i took a class and made it’s super PushButton. Then I made two methods to 1.set the options for me (that I statically knew I wanted" and 2. Instantiate the DateTimeWindow.

Second Level:  
The DateTimeWindow is a dynamically instantiated window (see above) that was done like this by Jim McKay to give coders the ability to instantiate Multiple Choosers. If I had kept this as a Window that had the “Implicit Instance” option set then that would not be possible.

Third:  
The DateTime\_Container sits atop the First level DateTimeWindow (or the dynamically created DateTimeWindow window called (mypicker). This will be your main Container.

Fourth:  
“Calendar\_Container1” and “Time\_Container1” are the Containers that hold the custom Canvas Classes that are actually drawing the clocks, calendar, and time picker time. There are two User Events that I wrote at this level to GIVE you the USER SELECTED Information.  
1. Calendar\_Container1 User Selected Date(s): use the “SelectedDate” event to receive your User’s date selection(s)  
2.Time\_Container1 User Selected Time: use the “SelectedTime” event t receive your user’s time selection.

![](http://i62.tinypic.com/2s8ojd0.png)

---

<div class="post-metadata">

**Author:** ![Mike\_Cotrone](https://forum.xojo.com/user_avatar/forum.xojo.com/mike_cotrone/32/19940_2.png) [@Mike\_Cotrone](https://forum.xojo.com/u/Mike_Cotrone)\
**Post date:** [May 3, 2014, 10:50pm UTC](https://forum.xojo.com/t/xojo-calendar-time-picker-question/16232/3 "2014-05-03T22:50:55Z")

</div>

How To Example:  
Mike’s Example on Replacing the DemoLaunch Window with a few methods that can be placed in your existing project and will launch the Calendar Time Chooser for you.

Pushbutton.action Event:

```auto
  CalTimeChooser = New DateTimeWindow
  CalTimeChooser.Left = Screen(0).AvailableWidth/2 - CalTimeChooser.Width/2
  CalTimeChooser.Top = Screen(0).AvailableHeight/3 - CalTimeChooser.Height/2
  mSetOptions
```

mSetOptions Method

```auto

  // Chooser Type:
  AssessmentSchedulerWindow.CalTimeChooser.VisiblePickers=Date_Time_Container.PickerElements.CalendarAndClock
  
  // Chooser Window Back Color
  AssessmentSchedulerWindow.CalTimeChooser.Date_Time_Container1.BackColor = RGB(239,239,239)
  
  // Chooser Time Format
  AssessmentSchedulerWindow.CalTimeChooser.Date_Time_Container1.Time_Container1.TimeMode = 12
  
  // Chooser Clock Face Type
  AssessmentSchedulerWindow.CalTimeChooser.ClockFaceType = Date_Time_Container.ClockFaceType.Chrome
  
  // Chooser Clock Hands Type
  AssessmentSchedulerWindow.CalTimeChooser.UseGraphicalClockHands=True
  
  // Chooser Week Start
  AssessmentSchedulerWindow.CalTimeChooser.WeekStartsOnMonday = False
  
  // Chooser Calendar to include previous/next days on calendar
  AssessmentSchedulerWindow.CalTimeChooser.IncludePrevNextMonthDays = True
  
  // Calendar Localization
  AssessmentSchedulerWindow.CalTimeChooser.LocalizationInt = 0
  
  // Allow User to Select Multiple Calendar Days
  AssessmentSchedulerWindow.CalTimeChooser.AllowMultipleCalendarSelections = False
  
  // Calendar Start Year
  Dim CurrentYear as New Date
  AssessmentSchedulerWindow.CalTimeChooser.Date_Time_Container1.Calendar_Container1.Calendar1.StartYear = 2000//CurrentYear.Year
  
  // Calendar End Year
  AssessmentSchedulerWindow.CalTimeChooser.Date_Time_Container1.Calendar_Container1.Calendar1.EndYear = CurrentYear.Year+1
```

---

<div class="post-metadata">

**Author:** ![Mike\_Cotrone](https://forum.xojo.com/user_avatar/forum.xojo.com/mike_cotrone/32/19940_2.png) [@Mike\_Cotrone](https://forum.xojo.com/u/Mike_Cotrone)\
**Post date:** [May 3, 2014, 11:00pm UTC](https://forum.xojo.com/t/xojo-calendar-time-picker-question/16232/4 "2014-05-03T23:00:49Z")

</div>

I wish I could edit ☹

I forgot to add my newest addition into this documentation (Reoccurring Selection). My need personally was the have a user make a selection and have the choice to have their selection follow a selected recurring schedule work flow. Now the workflow the coders will implement since I am just giving then “selected” option type for them to take and run.

I have a customer class that is essentially just an “information holder class”

To RECEIVE The user’s selected recurring Selection class use the following custom event:  
DateTime\_Container.Calendar\_Container.RecurringCanvas1.UserRecurring\_Choice event.

---

<div class="post-metadata">

**Author:** ![Tim\_Hare](https://forum.xojo.com/user_avatar/forum.xojo.com/tim_hare/32/176_2.png) [@Tim\_Hare](https://forum.xojo.com/u/Tim_Hare)\
**Post date:** [May 3, 2014, 11:33pm UTC](https://forum.xojo.com/t/xojo-calendar-time-picker-question/16232/5 "2014-05-03T23:33:52Z")

</div>

I think the question is

1. Can I use this in a project right now?
2. If so, how do I integrate the DateTimeWindow into my project?

I suspect the answer to the first question is “Not yet,” but I could be wrong.

---

<div class="post-metadata">

**Author:** ![Mike\_Cotrone](https://forum.xojo.com/user_avatar/forum.xojo.com/mike_cotrone/32/19940_2.png) [@Mike\_Cotrone](https://forum.xojo.com/u/Mike_Cotrone)\
**Post date:** [May 3, 2014, 11:35pm UTC](https://forum.xojo.com/t/xojo-calendar-time-picker-question/16232/6 "2014-05-03T23:35:45Z")

</div>

[quote=85287:@Tim Hare]I think the question is

1. Can I use this in a project right now?  
[/quote]  
Absolutely

> [@](#):
>
> 1. If so, how do I integrate the DateTimeWindow into my project?

My last post was an example to show how I implemented it into another app. I will make full documentation this week that will include implementation examples.

---

<div class="post-metadata">

**Author:** ![Tim\_Hare](https://forum.xojo.com/user_avatar/forum.xojo.com/tim_hare/32/176_2.png) [@Tim\_Hare](https://forum.xojo.com/u/Tim_Hare)\
**Post date:** [May 3, 2014, 11:42pm UTC](https://forum.xojo.com/t/xojo-calendar-time-picker-question/16232/7 "2014-05-03T23:42:04Z")

</div>

Right, but what components need to be dragged into the project for it to work? It would be nice if there were one more folder level, one top-level folder that contains all the essential pieces to make it work. Then you can drag the one folder into your project, throw a pushbutton on the window, add a property `picker as DateTimeWindow`, and write in the action event of the button

```auto
picker = New DateTimeWindow
picker.Show
```

Right now, there’s a lot of separate folders you need to include (or exclude).

n.b., I don’t have git, so I downloaded the zipped demo app, started dragging folders into a new project, and got lost.

---

<div class="post-metadata">

**Author:** ![Mike\_Cotrone](https://forum.xojo.com/user_avatar/forum.xojo.com/mike_cotrone/32/19940_2.png) [@Mike\_Cotrone](https://forum.xojo.com/u/Mike_Cotrone)\
**Post date:** [May 3, 2014, 11:43pm UTC](https://forum.xojo.com/t/xojo-calendar-time-picker-question/16232/8 "2014-05-03T23:43:33Z")

</div>

Gotcha Tim. thanks and ill see to make that easier to implement. That is the essential issue about making an elaborate demo version unfortunately, but Ill certainly do that.

Thanks again guys for the feedback!

---

<div class="post-metadata">

**Author:** ![Mike\_Cotrone](https://forum.xojo.com/user_avatar/forum.xojo.com/mike_cotrone/32/19940_2.png) [@Mike\_Cotrone](https://forum.xojo.com/u/Mike_Cotrone)\
**Post date:** [May 3, 2014, 11:45pm UTC](https://forum.xojo.com/t/xojo-calendar-time-picker-question/16232/9 "2014-05-03T23:45:01Z")

</div>

[quote=85289:@Tim Hare]Right, but what components need to be dragged into the project for it to work?  
[/quote]

For now for - Drag All folders into your project EXCEPT for the “Cal-Time Chooser Demo WIndow”. You will “replace” that functionality with the examples above and Tim’s example.

---

<div class="post-metadata">

**Author:** ![Peter\_Fargo](https://forum.xojo.com/user_avatar/forum.xojo.com/peter_fargo/32/977_2.png) [@Peter\_Fargo](https://forum.xojo.com/u/Peter_Fargo)\
**Post date:** [May 4, 2014, 9:38am UTC](https://forum.xojo.com/t/xojo-calendar-time-picker-question/16232/10 "2014-05-04T09:38:32Z")

</div>

I think James is having the same issue I had at the beginning. I have studied the code and now have no problem using the controls. For me it is a bit foreign. The end result is great but the journey was a little tough.

I would expect to be able to grab the time\_container or calendar\_container controls and drag them on any window like any other control and have them work. The selected\_date and time events would give me my results.

Having a third control date and time combined would save me a few steps if I required both.

What was confusing for me is requiring the date\_time\_container to use just the timer and the window as well. Shouldn’t the control encapsulate it’s own functionality? Clockface items the date\_time\_container rather than the time container or the time canvas itself seems to go against my understanding of encapsulation.

All that being said I love what Mike has created here and by the number of views I am awash in a sea of followers.

---

<div class="post-metadata">

**Author:** ![Jim\_Smith](https://forum.xojo.com/letter_avatar_proxy/v4/letter/j/edb3f5/32.png) [@Jim\_Smith](https://forum.xojo.com/u/Jim_Smith)\
**Post date:** [May 4, 2014, 5:11pm UTC](https://forum.xojo.com/t/xojo-calendar-time-picker-question/16232/11 "2014-05-04T17:11:14Z")

</div>

Thanks Mike.

Have modified the DemoLaunchWindow to add Button to some testing/debugging.  
Have this code in the action event of mybutton:

[code] dim dt as new date

dt.hour=19  
dt.Minute=15  
dt.day=25  
dt.month=4  
dt.Year=2011  
App.MyPicker.SelectedDate=dt[/code]

The result of this is to only show changes to the Clock Face, the time picker has not changed. If I click on the time picker field the time in the picker does change.

Another run-test with same result. Selected the Popup Menu to change clock face and time picker time changed.

Added the following code to my button’s action event:

` App.MyPicker.ClockFaceType = Date_Time_Container.ClockFaceType.Chrome
  App.MyPicker.Date_Time_Container1.Time_Container1.HideAMPM = False`

Ran the demo, click my button and time was displayed correct in both the clock face and time picker.

In none of these test did the calendar part change.

Mike thank you for making this available. Not only will this be used in my applications but more importantly in just the few day I have been reviewing your code I think I have learned more about OOP than I have in the past 50 years.

---

<div class="post-metadata">

**Author:** ![Mike\_Cotrone](https://forum.xojo.com/user_avatar/forum.xojo.com/mike_cotrone/32/19940_2.png) [@Mike\_Cotrone](https://forum.xojo.com/u/Mike_Cotrone)\
**Post date:** [May 4, 2014, 11:41pm UTC](https://forum.xojo.com/t/xojo-calendar-time-picker-question/16232/12 "2014-05-04T23:41:21Z")

</div>

James,

Setting the Time like that will not set the time picker time. I purpose built this as a chooser so the setting of the time/date are done by the User. By default the calendar chooser selects today’s date by default and the time is your current local time at the time you opened it. What result are you trying for or are you just playing with it?

Thanks!

---

<div class="post-metadata">

**Author:** ![Jim\_Smith](https://forum.xojo.com/letter_avatar_proxy/v4/letter/j/edb3f5/32.png) [@Jim\_Smith](https://forum.xojo.com/u/Jim_Smith)\
**Post date:** [May 5, 2014, 12:47am UTC](https://forum.xojo.com/t/xojo-calendar-time-picker-question/16232/13 "2014-05-05T00:47:40Z")

</div>

For now just playing and learning.

Later plan to use and an Appointment time-date selector in an application for personal use.

---

<div class="post-metadata">

**Author:** ![Mike\_Cotrone](https://forum.xojo.com/user_avatar/forum.xojo.com/mike_cotrone/32/19940_2.png) [@Mike\_Cotrone](https://forum.xojo.com/u/Mike_Cotrone)\
**Post date:** [May 5, 2014, 3:35pm UTC](https://forum.xojo.com/t/xojo-calendar-time-picker-question/16232/14 "2014-05-05T15:35:37Z")

</div>

James I am restructuring the code to make it easier to implement today. I am also creating detailed documentation that will also help. Thank you again for your help!

---

<div class="post-metadata">

**Author:** ![Kenneth\_Lossman](https://forum.xojo.com/user_avatar/forum.xojo.com/kenneth_lossman/32/2875_2.png) [@Kenneth\_Lossman](https://forum.xojo.com/u/Kenneth_Lossman)\
**Post date:** [May 5, 2014, 3:39pm UTC](https://forum.xojo.com/t/xojo-calendar-time-picker-question/16232/15 "2014-05-05T15:39:33Z")

</div>

Mike, can you re-post the link to where we can download this? I’m not seeing it…

---

<div class="post-metadata">

**Author:** ![Mike\_Cotrone](https://forum.xojo.com/user_avatar/forum.xojo.com/mike_cotrone/32/19940_2.png) [@Mike\_Cotrone](https://forum.xojo.com/u/Mike_Cotrone)\
**Post date:** [May 5, 2014, 4:07pm UTC](https://forum.xojo.com/t/xojo-calendar-time-picker-question/16232/16 "2014-05-05T16:07:42Z")

</div>

[https://github.com/mikecotrone/CalendarTimeChooser](https://github.com/mikecotrone/CalendarTimeChooser) - I am currently committing changes to it so be aware 🙂

---

<div class="post-metadata">

**Author:** ![Kenneth\_Lossman](https://forum.xojo.com/user_avatar/forum.xojo.com/kenneth_lossman/32/2875_2.png) [@Kenneth\_Lossman](https://forum.xojo.com/u/Kenneth_Lossman)\
**Post date:** [May 5, 2014, 4:19pm UTC](https://forum.xojo.com/t/xojo-calendar-time-picker-question/16232/17 "2014-05-05T16:19:19Z")

</div>

Mike, I have a question…when you select multiple dates or select a menu item from the reoccurring, is there an array that holds those dates selected??

By the way, nice job on the control

---

<div class="post-metadata">

**Author:** ![Mike\_Cotrone](https://forum.xojo.com/user_avatar/forum.xojo.com/mike_cotrone/32/19940_2.png) [@Mike\_Cotrone](https://forum.xojo.com/u/Mike_Cotrone)\
**Post date:** [May 5, 2014, 6:31pm UTC](https://forum.xojo.com/t/xojo-calendar-time-picker-question/16232/18 "2014-05-05T18:31:21Z")

</div>

Thanks Ken.  
The DateTime\_Container.Calendar\_Container1.SelectedDate receives the Selected dates via the inSelectedDate parameter.

I am relying on the event to fire and not creating any arrays. I didn’t want to muddle that part up for the coders. You could certainly populate an Array at that point.

Part of my restructuring of the code today is that I am adding at the same location another Event for the recurring “type” that the user selects. This will be in the event: DateTime\_Container.Calendar\_Container1.Recurring\_Selection. The only thing I am doing for the Recurring selection is passing what “Recurring Type” the user selected via the event. It is up to the Coder to make use of this/do something with it. I couldn’t get into the business of creating workflow since that could be a full time job 😉

I am hoping to have the first Draft of my user documentation finished tonight also.

Thanks again.

---

<div class="post-metadata">

**Author:** ![Mike\_Cotrone](https://forum.xojo.com/user_avatar/forum.xojo.com/mike_cotrone/32/19940_2.png) [@Mike\_Cotrone](https://forum.xojo.com/u/Mike_Cotrone)\
**Post date:** [May 6, 2014, 2:22am UTC](https://forum.xojo.com/t/xojo-calendar-time-picker-question/16232/19 "2014-05-06T02:22:16Z")

</div>

In case people are still looking at this post for the links:

Project Repository Link:  
[https://github.com/mikecotrone/CalendarTimeChooser](https://github.com/mikecotrone/CalendarTimeChooser)

Project Documentation:  
[https://github.com/mikecotrone/CalendarTimeChooser/tree/master/Documentation](https://github.com/mikecotrone/CalendarTimeChooser/tree/master/Documentation)

---

<div class="post-metadata">

**Author:** ![Wahed\_Qadri](https://forum.xojo.com/letter_avatar_proxy/v4/letter/w/34f0e0/32.png) [@Wahed\_Qadri](https://forum.xojo.com/u/Wahed_Qadri)\
**Post date:** [May 6, 2014, 11:14am UTC](https://forum.xojo.com/t/xojo-calendar-time-picker-question/16232/20 "2014-05-06T11:14:39Z")

</div>

Great work Mike! Awesome.

got a question for you, when I copy the folders into my project and just try to run I am getting around 41 errors almost all related to Time\_Container(window).Clock1

Most common listed below:  
Time\_Container(window).Clock1.ClockHourValue = Time\_Container(window).Clock1.ClockHourValue + .522  
Time\_Container(window).Clock1.Invalidate(False)

Sorry i am not into programming much so i am sound silly, but when i run your project standalone it works however on copying the folders to my project looks like something is going wrong.

Please advise and keep up the good work

Thanks

[Next page](https://forum.xojo.com/t/xojo-calendar-time-picker-question/16232.md?page=2)
