Date Picker

Anyone got any ideas or pointers about a usable Windows/OS X Date Picker control?

There is one in the examples. If that one isn’t suitable then it would help if you specify what you need.

Nevermind, I’ve found the Calendar Window example and I’ll work with that…

Or have a look at Norman’s website for a nicer one

http://www.great-white-software.com/Great_White_Software/REALbasic_Code.html

the above link goto www.example.com

Copy and paste the link does work. :wink:

yes i know… must be something wrong with the forum…

When you click the link button in the reply screen, there is a predefined template for making the link.

[url=http://example.com]link text[/url]

Markus forgot to replace the example link with his own link.
He only filled the link text.

Being an admin I fixed the link in Markus post - figured I should say that so no one thinks it was surreptitious
Simple oversight when pasting the link
Fun part is if you just put an URL in the text it works too like http://www.great-white-software.com/REALbasic_Code.html

Thanks Paul - I was actually not aware of where the link text goes as how I did it worked in the old forum. Might be an idea to put the dummy text in the link template.

Thanks Norman for fixing it.

Markus,
I usually replace the “link text” with a nice description and not the link.
In your case I would have done it like:

[url=http://www.great-white-software.com/Great_White_Software/REALbasic_Code.html]Great White Software - REALbasic Code[/url]

Result:
Great White Software - REALbasic Code :slight_smile:

I think they should change “link text” into “description” or something like that.

Test:

just the link: https://forum.xojo.com/2705-date-picker

paste link then select and make url: https://forum.xojo.com/2705-date-picker <- this isn’t working as it did on the REALbasic forum! Goes to example.com

insert link then fill in: <- there is no placeholder for the description if there is no text on the line before the link! see picture below:

Here is a DatePicker I found long ago, I changed the look and made a german version (Monday to Sunday)

The zip file includes english and german version

DatePicker

We use the Date, Time, and Calendar controls from Einhugur http://www.einhugur.com/index.html

Re the date picker in the examples, the update method is not calculating leap years correctly:

// Calculate February
If (mSelectedDate.Year / 4.0) = Floor(mSelectedDate.Year / 4.0) Then
  monthDays = 29 // Leap year
Else
  monthDays = 28

This will lead to 1900 being a leap year. Note, that years that can be divided by 100 are not leap years, unless they can be devided by 400.
So, while 2000 and 2400 are leap years, 2100, 2200 and 2300 are not.

I guess we will soon be facing the 2100 year problem… :slight_smile:

@Axel Schneider:

at first sight it looks as if it is the same as the example. Again, the same issue with leap years.

Here’s a correct calculation of DaysInMonth:

// returns the number of days for a given month
// DaysInMonth (month as Integer)
// returns Integer (either 28,29,30,31)

select case month
case 1,3,5,7,8,10,12
return 31
case 4,6,9,11
return 30
else
// now the work starts: is it a leap year?
if year mod 4 = 0 then
// usually yes, but if mod 100 = 0 then not (example: 1900 is not a leap year)
if year mod 100 = 0 then
// usually no, except if mod 400 = 0 (but 2000 is…)
if year mod 400 = 0 then
return 29
end if
return 28
end if
return 29
else
return 28
end if
end select

I used to have the calendar control from Einhugur but having problem when clicking on the date on the calendar control pop up, it also set focus on the control under the calendar.

replacement for the broken link above
DatePicker

Leap year calculations are no joke :slight_smile: