Project JEDI - Issue Tracker
Mantis Bugtracker

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0006169 [JEDI VCL] 00 JVCL Components minor always 2013-07-16 14:50 2014-09-03 11:29
Reporter altaveron View Status public  
Assigned To
Priority normal Resolution open  
Status acknowledged   Product Version 3.47
Summary 0006169: Incorrect position of a hint window with ShowCellHint = True
Description 1. 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 Information The 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;
Tags No tags attached.
Attached Files zip file icon 0006169.zip [^] (782,334 bytes) 2014-03-02 12:09
png file icon Actual Result.png [^] (91,413 bytes) 2014-03-02 12:09
png file icon Should Be.png [^] (90,282 bytes) 2014-03-02 12:09

- Relationships

-  Notes
(0020574)
altaveron (reporter)
2013-07-16 15:49

UPDATE: Code "Hint := 'Bla-bla-bla';" on step 1 is unnecessary.
(0020734)
obones (administrator)
2013-12-13 10:58

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.
(0020914)
altaveron (reporter)
2014-03-02 12:08

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;
(0020915)
altaveron (reporter)
2014-03-02 12:12

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:48 altaveron Issue Monitored: altaveron
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


Mantis 1.1.6[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker