Re: How Do I get informed when -showHelp: has been called?

2011-06-29 Thread Angus Hardie

On 29 Jun 2011, at 14:22, Ulf Dunkel wrote:

 I would really like to get a hint on this. Even a simple not possible would 
 help. Thank you. :-)
 
 - - - - -
 
 Am 27.06.2011 22:58, schrieb Ulf Dunkel:
 In a simple app of mine, I use the standard Help menu and MyApp Help
 menu item, which is bound to -showHelp:.
 
 I would like to have my AppDelegate being informed when the Help Viewer
 has been launched and opened from this menu item.
 
 It seems as if the method -showHelp: cannot be overridden. Which other
 way can I use to receive any information when -showHelp: has been called?
 
 TY in advance,
 ---Ulf Dunkel



I'm curious what you're trying to achieve here.


My first thought was that you could change the target of the menu item
so that it calls your own method, then call the original 
showHelp method with something like:

 [NSApp showHelp:sender]


This still might not actually display the help viewer 
for example if it had been removed from the system, or if something made it 
crash before it displayed.
I'm not sure what happens in those cases (an error in the log, or does it 
display an error alert?)
Not very likely perhaps though.


If you have to be more certain you might be able to view the active process 
list and observe
whether it contained the help viewer after the call to showHelp.

Alternatively maybe run a web server inside your app and make the help page 
load some object from it?

It depends on how certain you want to be I suppose. :-)

Perhaps others might have better ideas or could suggest another way of doing it.

Angus___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: [ANN] CoreParse

2011-06-06 Thread Angus Hardie

On 5 Jun 2011, at 18:22, Jens Alfke wrote:

 
 On Jun 5, 2011, at 6:21 AM, Thomas Davie wrote:
 
 I've just completed firming up the API and documentation for CoreParse.  
 CoreParse provides a powerful tokenisation and parsing engine, which uses 
 shift-reduce parsing (unlike ParseKit) to support a wide range of context 
 free grammars.
 
 Parsers can be built quickly and easily using BNF like syntax.
 
 Cool! What advantages does this have over using a more-established tool like 
 ANTLR? (“An Objective-C API” is an obvious answer, I suppose, but it doesn’t 
 look that difficult to call into ANTLR-generated C++ code from Obj-C.)
 




As a minor point, the current 3.x release of ANTLR has a (somewhat 
experimental) objective C API, but doesn't have a C++ API, you have to use the 
C API instead.

I think ANTLR 2.7.x has the C++ API, but I've never used it.

The ANTLR Objective C API appears to be making good progress and I'm hoping to 
switch from the C to Obj C APIs when ANTLR 4.0 is released.

I'm also looking forward to giving CoreParse a try too. It looks great.

Angus


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Writing an Uninstaller

2010-10-27 Thread Angus Hardie

On 27 Oct 2010, at 13:16, eveningnick eveningnick wrote:

 Hello
 I have an application that creats, when installed, a bundle in
 Applications and registers a .plist file for launchd in
 ~/Library/LaunchAgents (the agent is located in that bundle, and its
 process is launched everytime the OS starts).
 Thus, i can't let a user just to move bundle to the Trash bin, when he
 wants to get rid of it. Thats why, in a control panel of my
 application, i placed a button Uninstall, which
 1) stops the Agent
 2) deletes the plist file
 3) [should delete the bundle]
 
 This control panel is located in this bundle, that has to be deleted.
 And in Mac OS 10.6 a bundle whose application is running can't be
 deleted.
 What could i do here to delete the bundle? What is usually done in such cases?
 o) After uninstalling, ask user to manually move bundle to a trash
 bin, and then terminate control panel application? Seems pathetic,
 especially when user already pressed Uninstall.
 o) Copy a bundle-deleting script to the autorun once, that will
 launch next time with the next system boot? It seems like a good idea,
 but could it be done somehow without leaving traces afterwards?
 o) Copy to some autocleanined (like temp or something) folder a
 script, launch it and terminate control application. That script will
 wait, till the control app is terminated , and then remove the bundle.
 But does such a folder exist in MacOS? and how could it possibly be
 done?
 
 I don't want to rubbish  the user's Mac, if he/she doesn't like my App :)
 


Have you considered just killing the background process and then automatically 
moving your app to the trash before quitting?
It's simple and most end users understand the idea of old apps ending up in the 
trash. (If they even notice it at all)

(Using NSWorkspace)


Alternatively using launchd and WatchPaths to watch for the user moving your 
app out of its proper location 
and then automatically kill the background process and delete the launchd 
scripts.

I believe Sparkle uses the first approach to replace existing applications 
while Steam on the Mac does something like the latter.




Angus




___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Should I use NSDocument, NSUserDefaults or something else

2010-09-30 Thread Angus Hardie

On 30 Sep 2010, at 12:42, Jonny Taylor wrote:

 My app is a workstation for a type of microscope, which from the point of 
 view of the software consists of several different video cameras and some 
 other devices controlled over USB. Each camera has associated settings (e.g. 
 exposure) that I want to persist between app launches. I am not sure what the 
 best way is of storing this information. There are multiple cameras involved, 
 with each camera having quite a distinct role, so I would like to tie the 
 settings to individual camera serial numbers.
 
 I had a look into NSUserDefaults but that doesn't sound quite ideal. As far 
 as I can see (and I may be missing something) it is not inherently designed 
 for hierarchical data storage. If I wanted to store, say, QI1438.exposure and 
 PS1451.exposure as separate (flat) keys, then I don't think there would be a 
 way of specifying a default value for the generalized key exposure in 
 registerDefaults (regardless of the camera serial number). It could also be 
 argued that these settings are not really user preferences, particularly 
 since one could imagine having a different bank of settings for different 
 experiments.
 
 This made me think that an NSDocument might be a more appropriate solution 
 (different document for each experiment, storing a hierarchical dictionary of 
 key/value pairs but implementing my own handling of defaults for missing 
 keys, etc). However this class is understandably a very complex class and I'm 
 finding it hard to drill down to the details of what I would need to do in 
 order to implement this pretty basic functionality - particularly since in 
 some ways it would be a non-standard use of the class, in that the document 
 was not associated with one single window, etc. Can anybody point me towards 
 some example code that uses an NSDocument for this sort of application?


One point to note is that you can store an NSDictionary or an NSArray as a 
value in NSUserDefaults. 
That dictionary or array could store other dictionaries or arrays, which gives 
you a hierarchy.


Alternatively you could look at serializing the data to a plist file. If you 
have it in memory as an NSDictionary or NSArray then serializing to a plist is 
fairly simple
writeToURL:atomically: to write the dictionary to disk, 
dictionaryWithContentsOfURL: or initWithContentsOfURL: to read it in.
This is a bit more complicated than user defaults, but it keeps your data 
outside the defaults system (if that's what you want)


I would suggest that NSDocument might be more than you need.
It's more orientated towards user managed documents (e.g TextEdit) , while your 
app sounds more like something that manages the data itself. (More like iTunes)

Unless you intend the user to have sessions of usage and somehow switch between 
them, or distribute them in some way, which might be a reason to use NSDocument.


Angus


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Conversation-style controls?

2009-04-25 Thread Angus Hardie


On 24 Apr 2009, at 15:44, Christopher Gillis wrote:


How would I go about attaining a conversation-style layout. Tweetie (
http://www.atebits.com/tweetie-mac/ ) is a perfect example of the  
layout I

would like to achieve. I can get something similar by subclassing
NSTableView but it seems to me like it's a convoluted approach to what
should be a simple problem.


I believe that Adium uses webkit and javascript to do its (somewhat  
similar) controls.




--
Angus Hardie
angus.har...@malcolmhardie.com




___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com