Lazarus
Programming => Graphics and Multimedia => TAChart => Topic started by: acp693 on July 03, 2009, 12:25:35 pm
-
Hello,
After trying to use the OnMouseMove event of a TChart to display the X and Y coordinates in some TLabels, I discovered that the TChart OnMouseMove event is overridden in the Unit TAGraph. In Unit TAGraph I added the following line in the OnMouseMove procedure:
Unit1.Form1.Label1.Caption:= IntToStr(X)+ ' ' +IntToStr(Y);
I then added Unit1 to the uses in the Interface section of TAGraph. However compilation fails with the following message: tagraph.pas(39,1) Fatal: Can't find unit Unit1 used by TAGraph. Presumably this is because TAGraph resides in a different folder than the project?
Any Ideas How I make Unit1 visible to TAGraph?
Thanks
Albert
-
You cannot do that. Packages are compiled seperated from the main program and files from a project can depend (=use) on files in a package, but not the other way around.
-
Thanks Vincent, So how can I get the x y coords from the mouse movement if the OnMouseMove event is overridden on a Tchart object and I can't pass objects from my Form, to the TAGraph Unit where the OnMouseMove event is implemented?
Regards
Albert
-
Components should never use these events for their own use, but override the virtual MouseMove methind. What do you mean by an overridden OnMouseMove ?
-
Hello Marc, On line 262 of Unit TAGraph under protected, is the line:
procedure MouseMove(Shift: TShiftState; X, Y: Integer); override;
If I remove the override statement then x and y become available in the OnmouseMove event for my tchart (chart1) in my unit, However then the tchart Zoom functions etc. don't work anymore. I just assumed that override means override the OnMouseMove event of my chart1 component. I've most likely misunderstood something here. Any ideas?
Regards
Albert
-
I think there is a bug in TChart.MouseMove, that it does not call inherited always. Other TChart mouse method seem to be affected too.
Please create a bug report.
-
OK, I would call this a bug of TAChart. Overriding MouseMove like it is done is the way to do it.
I don't know if the author had a reason for not passing x and y
-
Hi, I posted a bug report. I notice that the bug is scheduled to be resolved for Target Version =>1.0.0 , Does this mean Lazarus version 1.0.0? As it took two years to get from version 0.9.22 to 0.9.26.2 ,it might take a long time to get resolved? I realise that this is a very minor bug and probably effects very very few people, but I can't procede with my application without this, as I need to interact with the charts using the mouse. Is there some kind of workaround?
I would willingly help in trying to resolve this, but as a complete oop newbie, I'm very much out of my depth. :(
Best regards and thanks for a truly great program, I voted for it in the community choice awards.
Albert
-
If you want it to resolved before, supply a patch, then we add it in the next release or the one after that, if the next release in imminent.