Howto add menu item to Mac OS Finder in Delphi XE2

Finally, I returned to this project and successfully registered service provider and handled service request. First of all I tried to use NSRegisterServicesProvider method, but there is no such method in Macapi sources, so I searched for applicationDidFinishLaunching delegate. Using it I registered my service provider: procedure TApplicationDelegate.applicationDidFinishLaunching(Notification: Pointer); var autoReleasePool: NSAutoreleasePool; app: NSApplication; provider: … Read more

How to correctly write Try..Finally..Except statements?

You just need two try/finally blocks: Screen.Cursor:= crHourGlass; try Obj:= TSomeObject.Create; try // do something finally Obj.Free; end; finally Screen.Cursor:= crDefault; end; The guideline to follow is that you should use finally rather than except for protecting resources. As you have observed, if you attempt to do it with except then you are forced to … Read more

How to free a generic TList?

Executive summary MyList.Free is sufficient. Detailed answer The TList<T> generic container owns its contents. When you free the container, the contents are also disposed of. Now, if T is an unmanaged reference, either a pointer or a class, then the list owns the reference. It does not own that which the reference refers to. So … Read more

What does `at ReturnAddress` mean in Delphi?

ReturnAddress is the address to which VerifyWrite would have returned when finished. Raise Exception.Create… at ReturnAddress means that when the exception dialog is displayed, it would indicate the address of the exception as being at ReturnAddress. In other words, the exception message would read Exception <whatever> raised at <ReturnAddress>: <Exception Message>. Here is an excerpt … Read more

Form is hidden behind other forms when ShowModal is called

You didn’t mention which version of Delphi… Newer Delphi versions have added two new properties to TCustomForm: PopupMode and PopupParent. Setting PopupParent of your modal dialog to the form that’s creating that dialog makes sure that the child form stays on top of it’s parent. It usually fixes the problem you’re describing. I think this … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)