1

I'm working with teechart and delphi XE4. I think my problem is pretty basic but, I can't find a solution.

In a short example, I have a TChartSeries with an event handler for the OnCLick event. In my code for event handling, I do the following:

if Button=mbRight then
begin
  clkSerie:=Sender;
  clkValue:=ValueIndex;
  GetCursorPos(P);
  pm1.Popup(P.X,p.Y);
end;

Then, in pm1.MyAction.OnClick

st:=InputBox('Agregar nota','Ingrese texto','');
if st<>'' then
begin
  clkserie.Marks.Item[clkValue].Text.Clear;
  clkserie.Marks.Item[clkValue].Text.Add(st);
  clkserie.Marks.Item[clkValue].Visible:=True;
end;

It works OK, with the only problem that, when I get out of this procedure, back in my chart with no popup menu or inputbox, I'm in "panning" status, it seems to be that the chart doesn't see my MOUSE_UP event.

I tried to simulate mouse clicks with mouse_event() and didn't worked. The only thing that worked is disabling panning for the chart, but I wouldn't like to take that way. I know there has to be a solution other than that.

I'll keep on trying and reading about that.

Thanks in advance.

shruti1810
  • 3,920
  • 2
  • 16
  • 28
  • 1
    Either the popup menu or the modal `InputBox` eat the mouse up message. Instead of showing the popup directly from your `OnClick` event handler, try only posting a custom message to your form and do the processing in its message hander (ie. delayed after mouse up has been processed). – Ondrej Kelle May 22 '15 at 18:23
  • I tried the following `if Button=mbRight then begin clkSerie:=Sender; clkValue:=ValueIndex; GetCursorPos(P); PostMessage(Self.Handle,WM_SERIE_CLICK,0,0); end; ` and, in message handler `SleepEx(200,false); pm1.Popup(P.X,p.Y);` with the same result. – Matias Nabarro May 22 '15 at 19:20

1 Answers1

5

Set Chart1.CancelMouse := True after click processing to stop the chart to initiate the default panning mode.

TLama
  • 75,147
  • 17
  • 214
  • 392
David Berneda
  • 490
  • 5
  • 9