Xojo Calendar / Time Picker - Question

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.

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 :slight_smile:

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.

The DateTime_Container sits atop the First level DateTimeWindow (or the dynamically created DateTimeWindow window called (mypicker). This will be your main Container.

“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.

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:

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

mSetOptions Method

  // Chooser Type:
  // 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
  // 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

I wish I could edit :frowning:

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.

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.

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

  1. Can I use this in a project right now?

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.

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

picker = New DateTimeWindow

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.

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!

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

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.

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.

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


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.


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?


For now just playing and learning.

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

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!

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

https://github.com/mikecotrone/CalendarTimeChooser - I am currently committing changes to it so be aware :slight_smile:

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

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 :wink:

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

Thanks again.

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

Project Repository Link:

Project Documentation:

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

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