Growl for OS X

BlitzMax Forums/Brucey's Modules/Growl for OS X

Brucey(Posted 2008) [#1]
BaH.Growl is an OS X-only module which adds Growl support to your applications.
Growl is a system for posting notifications to users. Applications like Adium, Skype, Cyberduck and Speed Download use it to inform the user of specific events.

You might use it to notify, for example, that a file copy is finished, or a particular function has completed.

It's free and fully documented, as usual. There are also a few small examples to help you use it.

Talking of examples, here a small "Hello World" one :
SuperStrict

Framework BaH.Growl

Local delegate:TGrowlDelegate = New TGrowlDelegate.Create()

delegate.SetApplicationName("HelloWorld")

delegate.SetAllNotifications(["Hello World"]) ' Supported notifications list

If delegate.Install() Then ' install the delegate, so that we can send notifications

	Local notification:TGrowlNotification = New TGrowlNotification.Create("Hello World", ..
		"Hello World!", "A small Hello World example from BlitzMax!")
		
	notification.Post() ' post the notification

End If


Any problems, comments, etc, please feel free to post them here.

:o)


Yahfree(Posted 2008) [#2]
Holy crap brucey... how... HOW do you make modules like every hour... do you have a robot sitting there coding for you??


Brucey(Posted 2008) [#3]
Actually, this one took a good chunk of the weekend :-p

..as I had to work out how to use Carbon as I went... as well as a wild goose chase trying to get pixmaps working with it.


For those that are wondering what a "notification" looks like, here's an example of Cyberducky telling me my file was uploaded :


The module lets you set the title, description and icon for your notifications.

:o)


Yahfree(Posted 2008) [#4]
I'm still trying to figure out wxMax... but it looks great :D

Side note: Where do you find documentation on Connect()?


Brucey(Posted 2008) [#5]
*cough* ... well, there's some flaky docs in wx.wx (for wxEvtHandler type). If you build docs, and rummage around in Third Party Modules -> wx.wx, there's some there.

Docs are, I'm afraid, lacking in places - only because there's been so much code to put in. I'm generally copy/pasting from the proper API docs and tweaking where necessary, but it's not as good as it might be - especially for examples.


Yahfree(Posted 2008) [#6]
Thats fine, not complaining :D, its amazing that you do all this for the community already.

one last question while i've got your attention (although i should probably make my own thread) How do you make a windows frame non-resizable? I cant find any docs on frame styles either :D.

Thanks in advance


Brucey(Posted 2008) [#7]
See other post about connecting to events ;-)


Brucey(Posted 2008) [#8]
Default frame style include wxRESIZE_BORDER, so you don't want to use the default.
Const wxDEFAULT_FRAME_STYLE:Int = wxSYSTEM_MENU | wxRESIZE_BORDER | wxMINIMIZE_BOX | ..
	wxMAXIMIZE_BOX | wxCLOSE_BOX | wxCAPTION | wxCLIP_CHILDREN

Take out what you don't want :-)


Yahfree(Posted 2008) [#9]
Not quite sure I get it - still cant find any list of frame style constants (went over wx.wx docs like 12 times now :D) am I missing something?


DannyD(Posted 2009) [#10]
Hi Brucey,
I tried running the example code
'
' Example to show customizing of the application icon
'
SuperStrict

Framework BaH.Growl


Incbin "process-stop.png"


Local delegate:TGrowlDelegate = New TGrowlDelegate.Create()

delegate.SetApplicationName("GrowlExample") ' the name that appears in the Growl Preferences
delegate.SetApplicationIconData(IncbinPtr("process-stop.png"), IncbinLen("process-stop.png"))

delegate.SetAllNotifications(["Example Notification"]) ' our list of supported notifications

If delegate.Install() Then

	Local notification:TGrowlNotification = New TGrowlNotification.Create("Example Notification", ..
		"An example notification", "Hey!~nWe changed the application icon!!")
	notification.Post()

End If




and get this error:




Building example
Executing:example.debug
dyld: Library not loaded: @executable_path/../Frameworks/Growl.framework/Versions/A/Growl
  Referenced from: /Applications/BlitzMax/mod/bah.mod/growl.mod/examples/example.debug.app/Contents/MacOS/example.debug
  Reason: image not found

Process complete


It looks like a problem with a library not being found but I can't find the library in the module folder to copy across to the package.

Any ideas?


thanks.


Brucey(Posted 2009) [#11]
You need to copy the Frameworks folder into your application Bundle.


For example, you compile the hello_world.bmx example in debug mode. This creates a hello_world.debug app bundle.
In Finder, if you Right-click on the app, and choose "Show Package Contents".
Then double-click on the Contents folder...
... this is where you copy the Framework folder.

Yes, again, BlitzMax doesn't support post-build scripting... so we need to do a bit of manual labour to get things into the right places. It's unfortunate, but not too terrible.
Also, if you don't delete the app, you can rebuild it many times, and you won't need to re-copy the Frameworks folder.


Brucey(Posted 2009) [#12]
While I'm here... I should mention that if you "Rebuild Documentation", you should find some of this information in Help -> Third Party Modules -> bah.growl

Part of my plans for world-domination include producing reasonably helpful documentation ;-)


TikiDays(Posted 2016) [#13]
Hi Brucey, is it possible to access the native Mac OS X or Windows notification features from Blitzmax?


Brucey(Posted 2016) [#14]
I imagine it could be.

If you can provide me with some links, I can look at implementing them ;-)