View Issue Details

IDProjectCategoryView StatusLast Update
0006169JEDI VCL00 JVCL Componentspublic2014-09-03 11:29
ReporteraltaveronAssigned To 
PrioritynormalSeverityminorReproducibilityalways
Status acknowledgedResolutionopen 
Product Version3.47 
Target VersionFixed in Version 
Summary0006169: Incorrect position of a hint window with ShowCellHint = True
Description1. Set the following properties of a TJvDBGrid instance:

          ShowCellHint := True;
          CellHintPosition := gchpDefault;
          ShowHint := True;
          Hint := 'Bla-bla-bla';

2. (optional step!) Use the following class of a hint window to make its font the same as on the a cell of the grid:

type
  TGridHintWindow = class(THintWindow)
    constructor Create(AOwner: TComponent); override;
  end;

constructor TGridHintWindow.Create(AOwner: TComponent);
begin
  inherited;
  Canvas.Font.Name := 'MS Sans Serif';
end;
 
procedure TForm1.ApplicationEventsShowHint(
  var HintStr: string; var CanShow: Boolean; var HintInfo: THintInfo);
begin
  if HintInfo.HintControl is TJvDBGrid then
  begin // ???????? ??? ??????
    HintInfo.HintWindowClass := TGridHintWindow;
  end;
end;

3. Move mouse to the cell and wait for a hint.

The hint window will appear on incorrect position. You will be sure that it's an issue with step 2.

The hint window should be at the correct position. The right one is:

  HintPos := Point(HintPos.X - 1, HintPos.Y - 1);
Additional InformationThe following code on the end of method CMHintShow() on JvDBGrid.pas:

    if not AtCursorPosition and HintWindowClass.ClassNameIs('THintWindow') then
      HintPos := ClientToScreen(CursorRect.TopLeft)
    else
      HintPos := InitialMousePos;

Should be replaced to the following code to fix the issue:

    if not AtCursorPosition and HintWindowClass.ClassNameIs('THintWindow') then
    begin
      HintPos := ClientToScreen(CursorRect.TopLeft);
      HintPos := Point(HintPos.X - 1, HintPos.Y - 1);
    end
    else
      HintPos := InitialMousePos;
TagsNo tags attached.

Activities

altaveron

2013-07-16 15:49

reporter   ~0020574

UPDATE: Code "Hint := 'Bla-bla-bla';" on step 1 is unnecessary.

obones

2013-12-13 10:58

administrator   ~0020734

Please try with the latest JVCL version in GIT (or daily zip) and then send us a zipped file containing the sources of an application showing the issue.

altaveron

2014-03-02 12:08

reporter   ~0020914

The correct code on step 2 (on Windows 7, Delphi XE2):

type
  TGridHintWindow = class(THintWindow)
    constructor Create(AOwner: TComponent); override;
  end;

constructor TGridHintWindow.Create(AOwner: TComponent);
begin
  inherited;
  Canvas.Font.Name := 'Tahoma';
  Canvas.Font.Size := 8;
end;

procedure TForm1.ApplicationEvents1ShowHint(
  var HintStr: string; var CanShow: Boolean; var HintInfo: THintInfo);
begin
  if HintInfo.HintControl is TJvDBGrid then
    HintInfo.HintWindowClass := TGridHintWindow;
end;

2014-03-02 12:09

 

0006169.zip (782,334 bytes)

2014-03-02 12:09

 

Actual Result.png (91,413 bytes)
Actual Result.png (91,413 bytes)

2014-03-02 12:09

 

Should Be.png (90,282 bytes)
Should Be.png (90,282 bytes)

altaveron

2014-03-02 12:12

reporter   ~0020915

Steps to reproduce:

1. Run the demo project.
2. Move mouse cursor to a cell and wait for a hint.

Actual result: Hint will be shown on the incorrect position (see the screenshot).

Should be: Hint should be shown on the correct position (see the screenshot).

Issue fix on the JVCL sources is located on "Additional Information" of the issue.

Issue History

Date Modified Username Field Change
2013-07-16 14:50 altaveron New Issue
2013-07-16 15:49 altaveron Note Added: 0020574
2013-12-13 10:58 obones Note Added: 0020734
2013-12-13 10:58 obones Status new => feedback
2014-03-02 12:08 altaveron Note Added: 0020914
2014-03-02 12:09 altaveron File Added: 0006169.zip
2014-03-02 12:09 altaveron File Added: Actual Result.png
2014-03-02 12:09 altaveron File Added: Should Be.png
2014-03-02 12:12 altaveron Note Added: 0020915
2014-09-03 11:29 obones Status feedback => acknowledged