Is it possible to use the TAdvOfficeHint with a TCheckListEdit? If so, how would I go about doing that?
Andrew
I can see how to add the OfficeHint property to a new custom control but not to TCheckListEdit - without a lot of work to create a new custom TCheckListEdit. Is that correct?
You could use the event AdvOfficeHint.OnBeforeShowHint and from there do the settings for a full Office style hint for TCheckListEdit by setting the AHintInfo: TAdvHintInfo parameters of this event.
Thanks Bruno. But I don't understand how the TAdvOfficeHint will recognise the TCheckListEdit without the TCheckListEdit having an OfficeHint property. Is that not a pre-requisite for the TAdvOfficeHint to work? Would you mind elaborating please?
It is not a pre-requisite.
When TAdvOfficeHint is dropped on the form it replaces the VCL hints.
It offers Office hints for components that have the OfficeHint property or for those hints where OnBeforeShowHint supplied the OfficeHint information.
'or for those hints where OnBeforeShowHint supplied the OfficeHint information'
I tested this with a form with TCheckListEdit and TAdvOfficeHint on the form:
Thanks Bruno. Adding 'CheckListEdit1.Hint := 'CheckListEdit';' to the form's FormCreate proc (or any string value) in the component's Hint property) fixed the problem. Without a string in the Hint property, the OfficeHint will not be displayed. Why would you need a redundant value in the Hint property for this to work? Seems like a bug?
VCL framework will not trigger hints for controls with an empty hint property.
Ah, ok obviously!. Thanks for your help.
Well, i've got it working ok on my app's main form, but on the form I want to use it on, only the CheckListEdit1 Hint items are displayed in a TAdvOfficeHint-like form - but not the Title, Note or Help AHintInfo items. I use the following TAdvOfficeHint AdvOfficeHint1BeforeShowHint proc to create both CheckListEdit1 Hints:
Did you drop TAdvOfficeHint on the other form?
If a problem persists, please send a sample source project with which we can reproduce this so we know exactly what you are doing.
Yes, TAdvOfficeHint was on both forms. I'll make a small project to demo this as soon as I can.
Here is a small demo which illustrates the issue:
There are several issues in your code.
I cleaned it up.
The reason I coded it that way was to avoid having the dummy CheckListEdit1.Hint value (none - required to trigger AdvOfficeHint1BeforeShowHint) as first item in the Hint. However, the main issue is that I didn't realise that only one TAdvOfficeHint component was required per app - not one per form. Anyway, thank you for your very rapid response to my issue.
I'm getting an AV in your version of the project if I first show the Prefs form and display a hint there and then return to the main form - placing the cursor on its CheckListEdit1 produces an AV. Can you reproduce that?
If you open & destroy the Prefs form, you'll need to check for it being assigned in the hint code.
Good point. Thanks.
All ok now. One minor point for a future update: the bottom of the TAdvOfficeHint's HintHelpText 'Press F1 for more help.' message is too close to the bottom border of the hint when the property 'Rounded' is set to True.