* * *

Author Topic: Cocoa TCalendar  (Read 761 times)

Frank

  • New member
  • *
  • Posts: 47
Cocoa TCalendar
« on: January 14, 2018, 05:22:19 pm »
I need a date component, macOS / Cocoa. My project (Windows/Linux/macOS.Carbon) had used TDateTimePicker. The "Month Display" of TDateTimePicker uses TCalendar, but this is not implemented (yet) in Cocoa. Xcode has NSDatePicker (& I see FPC has NSDatePicker.inc).

Is there any plans for a Calendar(ish) for Cocoa?
Is NSDatePicker.inc up to date?

Any ideas? Suggestions?
or should I just create a Bug Tracker issue...

Edit: I'm using the svn 1.9 version (updated daily)
« Last Edit: January 14, 2018, 05:27:10 pm by Frank »

wp

  • Hero Member
  • *****
  • Posts: 4213
Re: Cocoa TCalendar
« Reply #1 on: January 14, 2018, 05:32:06 pm »
There's CalLite on CCR (available through Online Package Manager). It does not contain any platform-specific code and, thus, should work on Cocoa (but never tested Cocoa myself).

See http://wiki.lazarus.freepascal.org/CalLite
« Last Edit: January 14, 2018, 05:37:31 pm by wp »
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10

Phil

  • Hero Member
  • *****
  • Posts: 2409
Re: Cocoa TCalendar
« Reply #2 on: January 14, 2018, 05:34:02 pm »
Is there any plans for a Calendar(ish) for Cocoa?
Is NSDatePicker.inc up to date?

NSDatePicker.inc is the Pascal interface created by parsing AppKit's NSDatePicker.h file. NSDatePicker.inc included with FPC is based on parsing of OS X 10.6, I believe, so it (and FPC's other parsed files) are quite old, but that may not matter if the basic classes and functions of NSDatePicker haven't changed (or, rather, if the current ones are just a superset of 10.6's).

You could probably create a custom LCL control which would be basically a wrapper around Cocoa's NSDatePicker. For an example, see the TWebBrowser custom control, which on Cocoa is just a wrapper around the native WebView control:

https://macpgmr.github.io/


Frank

  • New member
  • *
  • Posts: 47
Re: Cocoa TCalendar
« Reply #3 on: January 14, 2018, 05:57:55 pm »
@wp : Thanks. CalLite could be the TCalendar for Cocoa replacement, works with 64bit cocoa just fine.

@Phil : As usual, Thanks. I suspected NSDatePicker might be older, but thanks for confirming (if it's stable, it will not mater). Although CalLite would be a relatively quick replacement (& I will use it short term), I prefer to assist the development of Lazarus Cocoa (Although I'm new to widget-set code). I'll see what I can accomplish.

Phil

  • Hero Member
  • *****
  • Posts: 2409
Re: Cocoa TCalendar
« Reply #4 on: January 14, 2018, 06:01:26 pm »
@wp : Thanks. CalLite could be the TCalendar for Cocoa replacement, works with 64bit cocoa just fine.

@Phil : As usual, Thanks. I suspected NSDatePicker might be older, but thanks for confirming (if it's stable, it will not mater). Although CalLite would be a relatively quick replacement (& I will use it short term), I prefer to assist the development of Lazarus Cocoa (Although I'm new to widget-set code). I'll see what I can accomplish.

Actually, looking at Carbon widgetset's implementation for TCalendar, it's just a few lines of code. You could probably implement the Cocoa widgetset's and post as a patch.

The Orpheus TOvcCalendar control also appears to work with Cocoa, although it's not pretty. I think Orpheus is now supported by the download tool (can't think of its name right now).


wp

  • Hero Member
  • *****
  • Posts: 4213
Re: Cocoa TCalendar
« Reply #5 on: January 14, 2018, 06:16:00 pm »
The Orpheus TOvcCalendar control also appears to work with Cocoa, although it's not pretty. I think Orpheus is now supported by the download tool (can't think of its name right now).
Yes, Orpheus is available via Online Package Manager, just like TvPlanIt which contains a calendar as well. The problem with them is that they are part of huge collections of other components. CalLite, however, is not worse and it has the advantage that it is stand-alone ("Lite").
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10

Frank

  • New member
  • *
  • Posts: 47
Re: Cocoa TCalendar
« Reply #6 on: January 14, 2018, 06:18:18 pm »
@Phil : I was looking at carbon's implementation & was considering using it as my base. Although I'll admit, editing the carbon code is one thing, its getting the new code to interface with the LCL that (to me) is confusing... I havn't (yet) found the interface .inc's to edit to get the Lcl to use my new code.

Phil

  • Hero Member
  • *****
  • Posts: 2409
Re: Cocoa TCalendar
« Reply #7 on: January 14, 2018, 06:23:49 pm »
@Phil : I was looking at carbon's implementation & was considering using it as my base. Although I'll admit, editing the carbon code is one thing, its getting the new code to interface with the LCL that (to me) is confusing... I havn't (yet) found the interface .inc's to edit to get the Lcl to use my new code.

Cocoa widgetset does not yet have a cocoacalendar.pas or something like that. It would have to be added.

Since Dmitry is hot and heavy on fixing Cocoa widgetset right now, a bounty for TCalendar implementation might be in order.

Frank

  • New member
  • *
  • Posts: 47
Re: Cocoa TCalendar
« Reply #8 on: January 14, 2018, 06:31:36 pm »
Since Dmitry is hot and heavy on fixing Cocoa widgetset right now, a bounty for TCalendar implementation might be in order.


 He's doing a great job, fixed several issues I've reported. The Cocoa IDE is progressing nicely. I'd like to help, but unable to in a financial way...

Phil

  • Hero Member
  • *****
  • Posts: 2409
Re: Cocoa TCalendar
« Reply #9 on: January 14, 2018, 06:32:56 pm »
Yes, Orpheus is available via Online Package Manager, just like TvPlanIt which contains a calendar as well. The problem with them is that they are part of huge collections of other components. CalLite, however, is not worse and it has the advantage that it is stand-alone ("Lite").

Yes.

An advantage of a "native" TCalendar (based on, say, NSDatePicker) over all other calendar controls is that it's more likely to look like a normal Cocoa control - ie, a calendar control that looks like what other Mac programs use. Same advantage to using standard file open, save, etc. dialogs - anything else just looks like an invasive species.

Anytime LCL resorts to a purely "custom" control, it tends to look less good on Mac. Example: TStringGrid, which really doesn't look like a Cocoa TableView.

Ñuño_Martínez

  • Hero Member
  • *****
  • Posts: 723
    • Burdjia
Re: Cocoa TCalendar
« Reply #10 on: January 15, 2018, 10:41:01 am »
I came a bit late, but I have a custom flexible calendar too. http://www.burdjia.com/en/projects/brdcl
Are you interested in game programming? Join the Pascal Game Development community!

Frank

  • New member
  • *
  • Posts: 47
Re: Cocoa TCalendar
« Reply #11 on: February 13, 2018, 08:39:49 pm »
I have a Cocoa TCalendar (based on NSDatePicker) just about ready.

What is the procedure to have it reviewed/added to Lazarus' svn ,
simply post it as a bug with attached patch files? Or is there more to it?

 

wp

  • Hero Member
  • *****
  • Posts: 4213
Re: Cocoa TCalendar
« Reply #12 on: February 13, 2018, 11:09:07 pm »
Yes, post it to bugtracker along with patch file and demo project.
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus