[Lazarus] Mac OS X : Look up in dictionary service...

dominique at savagesoftwaresolutions.com dominique at savagesoftwaresolutions.com
Mon Sep 7 00:52:43 CEST 2009


Hi Dimitry,
  Thanks for the detailed answers, I will pore over the details for
handling carbon events tomorrow.

I just wanted to point out that I tried to implement the DropFiles as per
Lazarus' but when I double click on my file, the 
FormDropFiles event never fires if the application is shutdown, but does
fire correctly if the application is already running.

Dominique.

On Sun, 6 Sep 2009 23:52:47 +0400, dmitry boyarintsev
<skalogryz.lists at gmail.com> wrote:
>>  What is the difference between AEInstallEventHandler and your
>> InstallXXXEventHandler functions?
>> I noticed that in carbonobject.inc in RegisterEvents it calls both, but
I
>> don't understand why each is required.
> The difference is in getting event targets.
> 
> There's common type used: EventTargetRef
> But to aquire it, there're different functions:
> 
> GetApplicationEventTarget (gets application event target. I guess it's
> the one you need for using services)
> 
> GetControlEventTarget (gets target from ControlRef or HIViewRef)
> GetWindowEventTarget (target from WindowRef)
> etc...
> 
> You can learn more about handling carbon events here:
>
http://developer.apple.com/legacy/mac/library/documentation/Carbon/Conceptual/Carbon_Event_Manager/Intro/CarbonEventsIntro.html
> 
> API reference can be found at this link:
>
http://developer.apple.com/legacy/mac/library/documentation/Carbon/Reference/Carbon_Event_Manager_Ref/Reference/reference.html
> 
>> I was also hoping that my application would respond to the
>> kAEOpenDocument
>> event, and looked in the Lazarus code base to see how it handles opening
>> .pas files from the Finder, but couldn't work that out either. I have
the
>> application association working with the doc/file am interested in, but
>> can't work out how my app passes that filename to my app to I can
>> actually
>> open it.
> 
> There're 2 ways:
> Lazarus way (prefferable):
> Select the main application's form:
> set AllowDropFiles to true
> implement OnDropFiles event, to load opened files
> 
> Depsite of its name the event is called then somebody double-clicks
> (or tries to open) on the registered file-type in Finder.
> Dragging files on the form is not yet supported (no need to bug
> report, as it's known issue).
> 
> Carbon only way:
> 1st) Register kAEOpenDocument event (check procedure
> TCarbonWidgetSet.RegisterEvents at carbonobjects.inc);
> 
> No matter, what way you chose
> you must register the file extension (or document type) to be opened
> with your application.
> It's done by modifying bundle's Info.plist CFBundleDocumentTypes
property.
> 
> See these docs
>
http://developer.apple.com/mac/library/documentation/MacOSX/Conceptual/BPRuntimeConfig/Articles/PListKeys.html#//apple_ref/doc/uid/20001431
> 
> Use Lazarus.app Info.plist as an example (or any bundle in the system,
> i.e. TextEdit)
> 
> thanks,
> dmitry
> 
> --
> _______________________________________________
> Lazarus mailing list
> Lazarus at lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus




More information about the Lazarus mailing list