How to use F1 =more help

Using TAdvGlowButton.OfficeHint.OfficeHint.ShowHelp ...


I've been unable to figure out how to respond to an F1 keypress when the Hint is showing.
I guess I should use the TAdvOfficeHint.OnbeforeShowHint.
Get the contextID of the object and when F1 is pressed, jump to the help page with this context ID.

When F1 is pressed the hint closes. 
Any help is appreciated.


I have one way to implement the F1= more help when using TAdvGlowButton.OfficeHint.ShowHelp =True.

I am not confident it is without problems and invite comments on this code shell.
 
There will be a TAdvOfficeHint on mainForm.
Each TAdvGlowButton with .OfficeHint=True will have .Notes = 'some text'.
mainForm.KeyPreview = true;
 
In mainForm declare:
  AdvHintInfoNotes : TStrings;
  AdvOfficeHint_HelpID : integer;
 
In mainForm.AdvOfficeHintBeforeShowHint(AControl; AHintInfo; var UseOfficeHint : Boolean);
begin
  if not (AControl as TAdvGlowButton.OfficeHint.ShowHelp then exit;
  // only act where more help has been offered
  AdvHintInfoNotes := AHintInfo.Notes;
  // this is Free'd when the Hint window is destroyed; I need to know when the officeHint is not showing
  AdvOfficeHint_HelpID := AControl.HelpContext;
  // the ID to use to jump to
  AdvToolBarPager.SetFocus;
  // give focus back to the AdvToolbarPager or else it will not participate in mainForm.KeyPreview
  // Why is this?
end;
 
In mainForm.FormKeyDown(Sender; Key)
begin
  if (Key=VK_F1) and assigned(AdvHintInfoNotes) then
  // I need to know the Notes var is not nil; that is, the Hint is still showing
  begin
    forms.application.help(AdvOfficeHint_HelpID);
  end;
end;
 

Correction. At the top of mainForm.AdvOfficeHintBeforeShowHint use

 
if (AControl is TAdvGlowButton) then
if not (AControl as TAdvGlowButton).OfficeHint.ShowHelp then Exit;
 
Use a similar statement if you use other controls such as the TAdvGlowMenuButton.
 
 

TAdvOfficeHint.OnbeforeShowHint returns the control for which the hint was triggered via 

the AControl parameter. Store a reference to this control and use it in the TAdvToolBarPager.OnKeyDown event when a check for F1 is done from there.

Hello Bruno

Maybe I am missing somethings ... I desire a solution to using F1=Help when and only when an OfficeHint is showing for some AControl with its ShowHelp property =true. In the solution you propose, the hint can be showing and an F1 press is not seen by the TAdvToolBarPager. How? When the mouse glides over the AControl and the Pager has not received focus after loosing focus. I suggest ... in the AdvOfficeHint.OnBeforShowHint procedure some action is required. I give focus to the Pager.
 
Also, in your solution F1=Help can be triggered when the OfficeHint has been destroyed. How? Click in the Pager. The pager has focus. Glide over an AControl. Its Hint is presented. Glide away from the AControl. The OfficeHint is removed. The Pager has focus and when F1 is not pressed the Pager presents the HelpPage for the AControl whose hint is not showing.  To achieve my goal of not acting on F1=Help is the OfficeHint is not showing we could thek that the OfficeHint is showing by looking at its Notes=TStrings pointer. THis is Free'd when the OfficeHint is Destroyed.
 
Maybe there are beter solutions ... Mine is the firstone I thought of.

The event will be triggered when F1 is pressed while the hint is showing.