Recent

Author Topic: Anyone have any sample code to use the Mac notification center such as Banner?  (Read 22634 times)

vonskie

  • Full Member
  • ***
  • Posts: 184
Anyone have any sample code to use the Mac notification center such as Banner?


skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Stackoverflow link
Could be translated 1-to-1 into Objective-P.

Warning: it's Cocoa API, so potentially could have the same problems as speech synthesizer has. None known yet, but I this is due nobody tested the application on memory leaks (using Xcode tools)

vonskie

  • Full Member
  • ***
  • Posts: 184
Stackoverflow link
Could be translated 1-to-1 into Objective-P.

Warning: it's Cocoa API, so potentially could have the same problems as speech synthesizer has. None known yet, but I this is due nobody tested the application on memory leaks (using Xcode tools)

Thanks for the link I am rather new to mac osx dev or any dev using free pascal. So far I like the write once compile anywhere of it. So I would have no clue on how to use the API or convert that code. Thank you for your work on the tts. 

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
So far I like the write once compile anywhere of it.
wait, wait, wait.... are you saying you looking into using some sort of Windows notifications as well? Or do you have one implemented?

vonskie

  • Full Member
  • ***
  • Posts: 184
So far I like the write once compile anywhere of it.
wait, wait, wait.... are you saying you looking into using some sort of Windows notifications as well? Or do you have one implemented?

Just on the Mac side I would like to add notifications to the program. I will look at the tts coca stuff and see if I can figure out how to do the mac notifications. With the link you provided.

Thanks again

vonskie

  • Full Member
  • ***
  • Posts: 184
Well I looked at the tts code and realized I do not have the programming knowledge to write it.

jwdietrich

  • Hero Member
  • *****
  • Posts: 1232
    • formatio reticularis
It may be a bit off-topic but you might want to support notifications via Growl. See http://forum.lazarus.freepascal.org/index.php/topic,8839.0.html for a discussion and a link to sample code.

Edit: Growl also integrates with Notification Center, although it also supports older versions of Mac OS X. See http://arstechnica.com/apple/2012/09/hands-on-growl-2-0-integrates-with-notification-center-on-os-x-ios/
« Last Edit: March 20, 2014, 08:29:48 pm by jwdietrich »
function GetRandomNumber: integer; // xkcd.com
begin
  GetRandomNumber := 4; // chosen by fair dice roll. Guaranteed to be random.
end;

http://www.formatio-reticularis.de

Lazarus 2.2.6 | FPC 3.2.2 | PPC, Intel, ARM | macOS, Windows, Linux

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
It may be a bit off-topic but you might want to support notifications via Growl...
How about a summarizing wiki page? It helped for tts :)

Non-offtopic, imho. Alternatives (with ready to use code) are always welcome

vonskie

  • Full Member
  • ***
  • Posts: 184
It may be a bit off-topic but you might want to support notifications via Growl. See http://forum.lazarus.freepascal.org/index.php/topic,8839.0.html for a discussion and a link to sample code.

Edit: Growl also integrates with Notification Center, although it also supports older versions of Mac OS X. See http://arstechnica.com/apple/2012/09/hands-on-growl-2-0-integrates-with-notification-center-on-os-x-ios/

I looked at growl, but mac osx mav already has a notification type center that works well. I wanted to use that somehow.

It would be a big win for freepascal on the mac platform if we could figure out how to get the notifications working on the mac.

I wish I had a deeper understanding of the TTS program that was done so I could try it with the notifications.



vonskie

  • Full Member
  • ***
  • Posts: 184
It may be a bit off-topic but you might want to support notifications via Growl...
How about a summarizing wiki page? It helped for tts :)

Non-offtopic, imho. Alternatives (with ready to use code) are always welcome

That would be awesome.


skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
I wish I had a deeper understanding of the TTS program that was done so I could try it with the notifications.
It has nothing to do about TTS specifically. TTS is just an example of how ObjC API can be used in FPC (by using Objective Pascal)

Here're a page you could look at for more knowledge:

vonskie

  • Full Member
  • ***
  • Posts: 184
I wish I had a deeper understanding of the TTS program that was done so I could try it with the notifications.
It has nothing to do about TTS specifically. TTS is just an example of how ObjC API can be used in FPC (by using Objective Pascal)

Here're a page you could look at for more knowledge:

Checked that link out thanks. I got a head ache from it. I will have to read over it a few times.


vonskie

  • Full Member
  • ***
  • Posts: 184
I wish I had a deeper understanding of the TTS program that was done so I could try it with the notifications.
It has nothing to do about TTS specifically. TTS is just an example of how ObjC API can be used in FPC (by using Objective Pascal)

Here're a page you could look at for more knowledge:

So you used a PHP parser to create the first TTS pas file?

Did you use the one at

http://www.objectivepascal.com/parser/index.html ?

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
So you used a PHP parser to create the first TTS pas file?

Did you use the one at
kind of.. well I didn't use the parser myself, but I can tell you that parser was used to generate the file.

http://www.objectivepascal.com/parser/index.html ?
The site provides you with CocoaAll (MacOS 10.8 SDK) package.
If you download the package and look inside of Cocoa folder. You should find "foundation" directory. Within this file there should be NSUserNotification.inc file generated.
The file should contain the objc class declaration that you're looking for.

(in other words, everything is parsed for you already)

vonskie

  • Full Member
  • ***
  • Posts: 184
My exposure to free pascal is about 30 days so there is much I do not understand.


 

TinyPortal © 2005-2018