OnEnter and OnExit events dont work

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Bugsie
Newbie
Newbie
Posts: 15
Joined: Mon Jun 26, 2006 12:00 am
Location: Sydney

OnEnter and OnExit events dont work

Post by Bugsie » Wed Nov 15, 2006 1:41 am

I am using Cbuilder6 with TChartPro 7.07

With the TChart, i need to use the OnExit event to hide some popup text when the mouse moves off the chart. (I have multiple Area series on the chart)

The OnExit and also the OnEnter events never get activated

This is easy to reproduce, just create these events and set a break point using the bebugger in the OnEnter or OnExit events

This not a biggie, just want the app to look a bit cleaner

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed Nov 15, 2006 10:11 am

Hi Bugsie,

Yes, this is a known issue(TV52011492) with a high-priority on our defect list to be fixed for future releases.

In the meantime you can simulate those events doing something like this:

Code: Select all

void __fastcall TForm1::FormMouseMove(TObject *Sender, TShiftState Shift, int X,
	  int Y)
{
	if (MouseOnChart)
	{
		MouseOnForm=true;
		MouseOnChart=false;
		Chart1->Title->Text->Clear();
		Chart1->Title->Text->Add("Exit Chart");
	}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Chart1MouseMove(TObject *Sender, TShiftState Shift,
	  int X, int Y)
{
	if (MouseOnForm)
	{
		MouseOnChart=true;
		MouseOnForm=false;
		Chart1->Title->Text->Clear();
		Chart1->Title->Text->Add("Enter Chart");
	}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject *Sender)
{
	MouseOnChart=false;
	MouseOnForm=true;
}
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Mariano
Newbie
Newbie
Posts: 46
Joined: Fri Nov 15, 2002 12:00 am
Location: España

Post by Mariano » Wed Nov 15, 2006 10:16 am

hi,

OnExit and OnEnter are related with the FOCUS not the mouse position.
(this is valid for all the delphi's vcl, try with a TPanel)

I did have a similar problem, I did use the OnMouseMove of the Form and test the position of the mouse ( PtInRect or by hand). This is not perfect but it works.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri Nov 17, 2006 1:04 pm

Hello everyone,

Sorry for the confusion, Mariano is right. For those events to work the chart needs the focus. When it has the focus then all OnKeyxxxx events also work:

Code: Select all

procedure TForm1.Chart1Enter(Sender: TObject); begin
  Color:=clWhite;
end;

procedure TForm1.Chart1Exit(Sender: TObject); begin
  Color:=clBtnFace;
end;

procedure TForm1.Button1Click(Sender: TObject); begin
  Chart1.SetFocus;
end;

procedure TForm1.Chart1KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  Caption:=IntToStr(Key);
end;
Regarding Bugsie's request, we could add OnMouseEnter and OnMouseExits events.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply