OnMouseEnter event for chart

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
ASML Delphi team
Newbie
Newbie
Posts: 2
Joined: Tue Jul 17, 2007 12:00 am

OnMouseEnter event for chart

Post by ASML Delphi team » Tue Feb 17, 2009 3:53 pm

Hi,

I'm using TeeChart Pro v8.02.10861

I have a panel with multiple(1 to 7) charts on it.
To save space, the legends are all invisible and one main legend has been added as a toolbar to cover all charts.
However, to allow the users of my application to manipulate each chart separately a floating (not drawn on the chart's own panel) legend(chart specific) should automatically popup when the cursor moves over any of these charts.
This popup legend should appear outside the chart area itself so it will not hide any information on the chart. The popup should disappear again when the cursor leaves the chart.
All this should happen without the user needing to click on the chart.

To achieve this, I am looking for an OnMouseEnter and an OnMouseLeave event of the chart or a way to simulate these events.
Using the main form's OnMouseMove event did not result in the required behavior.

Is there a way to achieve this?

Regards,
Arthur

Yeray
Site Admin
Site Admin
Posts: 9602
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Post by Yeray » Thu Feb 19, 2009 2:55 pm

Hi Arthur,

Yes, as you'll see here, this is a known issue but you can use a workaround.

If you find any trouble with this, please, feel free to ask about it.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

ASML Delphi team
Newbie
Newbie
Posts: 2
Joined: Tue Jul 17, 2007 12:00 am

Post by ASML Delphi team » Thu Feb 19, 2009 3:34 pm

Hi Yeray,

I read the post you mentioned.

Typically the users of my application do not manipulate the graphs other then (de)selecting series in the legend. This means I can not use the focus state of the charts (OnEnter and OnExit).

I tried using the OnMouseMove of the main form as suggested in that post.
Unfortunately this event is not reliable enough to trigger my floating legend.
You would expect the event to be fired for every pixel the mouse moves, however this is not the case when the mouse moves to quickly. This means the user would have to move the mouse slowly onto/over a chart for the legend to work, in which case a mouse click would be more practical (but unwanted!).
Yes, this is a known issue(TV52011492) with a high-priority on our defect list to be fixed for future releases.
Do you know in what release will this issue be fixed?

Regards,
Arthur

Yeray
Site Admin
Site Admin
Posts: 9602
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Post by Yeray » Fri Feb 20, 2009 9:23 am

Hi Arthur,

In fact, the issue regarding OnEnter and OnExit (TV52011492) is closed. We decided that's not a bug. Simply, the chart needs the focus to fire those events.

On the other hand, there is the OnMouseEnter and OnMouseExit request (TV52011903) in the wish list. But I'm afraid I can't give you a date for this to be fixed.

I'd like to apologize for the inconvenience and the confusion.

Finally, I think that maybe you could activate the focus at OnMouseMove only the first time the mouse enters each chart. Could you try if the following code works better at your end?

Code: Select all

var
  Form1: TForm1;
  ChartList: array [0..1] of TChart;

implementation

{$R *.dfm}

procedure TForm1.Chart1MouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
var tmpChart: TCustomChart;
i: Integer;
begin
  tmpChart:=(Sender as TCustomChart);
  if not tmpChart.Focused then
  begin
    tmpChart.SetFocus;
    for i:=0 to length(ChartList)-1 do ChartList[i].Legend.Visible := ChartList[i].Focused;
  end;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Chart1.OnMouseMove := Chart1MouseMove;
  Chart2.OnMouseMove := Chart1MouseMove;

  ChartList[0] := Chart1;
  ChartList[1] := Chart2;
end;
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply