Sunday, September 6, 2009

IDE Fix Pack 2010 – ObjectInspector F1 key

I got many requests to add a patch for the non-functioning F1 key in the Object Inspector. So I spend 2 hours trying to find out where the F1 got lost and what Delphi 2009 does what 2010 doesn’t. My research showed that Delphi 2009 calls a function named “ShowPropertyHelp” while Delphi 2010 skips this call. Before the call to ShowPropertyHelp there is a call to a function named “GetTrait”.In Delphi 2009 it returns an interface while in Delphi 2010 it returns nil.

Then I remembered that I saw something in ToolsAPI.pas that was called “Traits”. So I looked into it and found the IOTAPersonalityServices interface. By analyzing the GetTrait “call parameters” I was able to extract the GUID that is used for the IOTAPersonalityServices.GetTrait(ATraitGUID) parameter. It seems that in Delphi 2010 the Property-Help trait is missing or GetTrait doesn’t return it.

The next step was to try to add the “trait” by calling the IOTAPersonalityServices.AddPersonalityTrait method with the personality ID and the extracted GUID. And vólà the F1 key in the Object Inspector is back.

No comments: