OfficeHint programming

Delphi XE, TMS Component Pack

Am struggling to get OfficeHints to show. I have a TAdvOfficeStatusbar with some Panels with Button=true, and am calling a routine which tries this: 

    AStatusBar.ShowHint := true;
    AStatusBar.Panels[Ord(status_next_button)].OfficeHint.Title := 'fred';
    AStatusBar.Panels[Ord(status_next_button)].OfficeHint.Notes.Text := 'next';
    AStatusBar.Panels[Ord(status_next_button)].OfficeHint.ShowHelp := true;
    AStatusBar.Panels[Ord(status_next_button)].Text := '>';

There is an AdvOfficeHint on the form. No hints appear: what step(s) am I missing please? (The TMS supplied Sample with a TadvOfficeStatusbar shows the hint OK.)

Thanks - Mike

Are there other components on this form that could interfere?
When you put a TAdvGlowButton on this form with also OfficeHint settings defined, is it showing the office hint for this TAdvGlowButton?

No. If I put  an AdvGlowbutton on the form I just see it and no hints are visible or appear when the mouse hovers over. (The AdvGlowButton does change colour as expected with mouse over.) Do I need to activate some ShowHints Boolean somewhere? 

On a  new blank form everything works OK. Sorry to have bothered you, Bruno; I will trace the cause.


Further investigation shows me I'm getting interference if I put a TAdvOfficeHint on my form.

The form already has (and has had for some years) a DoShowHint procedure which is set to Application.ShowHint. 

 procedure TFormConcord.DoShowHint(var HintStr: string; var CanShow: Boolean;
  var HintInfo: THintInfo);
  AGrid: TWSAdvStringGrid;
  if (HintInfo.HintControl is TWSAdvStringGrid) then
    AGrid := TWSAdvStringGrid(HintInfo.HintControl);
    HintInfo.HintStr := AGrid.HintString(HintInfo.CursorPos,

etc. What happens when this gets called is the HintInfo.MaxWidth gets set to the width of my screen instead of (as previously) the size of the hint itself. THe result is I do get a hint, styled according to the current styler, but it is far too long. If I insert

    HintInfo.HintMaxWidth := HintInfo.CursorRect.Right-HintInfo.CursorRect.Left+10;

It gets to a more reasonable size (but not actually to the screen width of the string -- that can be fixed I guess). 

The issue seems to be that FindHintWindow gets called and gets hold of the TadvOfficeHint and that's where things go astray.If I remove the AdvOfficeHint everything is OK again but I'm still not getting individual hints for different AdvStatusbar panels of course.

Any advice for such a situation? (My TWsAdvStringGrid is a considerably adapted TAdvStringGrid for specific linguistic tasks and in this case I'm getting it to find column header hints which are not designed but retrieved programmatically depending on the data type.)

Thanks -- Mike 

Bruno, hi

In AdvOfficeHint around line 1042 I have this, where a hint is not HTML formatted:
    if (s <> '') then
      TxtH := DrawText(Canvas.Handle,PChar(s), Length(s), hr, dtfmt);

  TxtHDiv := Canvas.TextHeight('gh');
  TxtH := TxtH + (TxtHDiv div 2) + 2;

  Result := Rect(0,0,MaxWidth,TxtH);

Shouldn't the Result be Rect(0,0,hr.Right-hr.Left,TxtH) ???


I do not have your full code, but I do see that when you override Application.OnShowHint, this interferes with having TAdvOfficeHint handling the hint. When assigning an event handler for Application.OnShowHint, a hint is only shown when control.Hint is set and not anymore when AdvGlowButton.OfficeHint is set and not AdvGlowButton.Hint. 
It is unclear how this could have previously worked and also, we haven't changed anything recently in this mechanism, so I cannot see a change in TAdvOfficeHint being responsible for this.