Compiled exe not running lazarus / 55-TAChart ---------------------------------------------------------------------- Davidous · 2022-03-04 08:06 Hello All, after a while I would need a little help again. I have a program that I made with Lazarus 2.0.8. There are TACharts in it. Everything was OK, I could compile the program and run the exe just fine. Yesterday I updated to Lazarus 2.2.0 x64. The program compiles OK, but the compiled exe does not run... Have anyone ever experienced something like this? Thank you in advance! Best regards, David ---------------------------------------------------------------------- WooBean · 2022-03-04 08:26 Hi, were you able to compile and run any "Hello world" type program? Anyway, say more about your OS. It may be UAC or antivirus setting issue or Lazarus invalid configuration. ---------------------------------------------------------------------- Davidous · 2022-03-04 08:59 Hi, Hello World works. I have win 10 64 bit on my computer. The interesting thing is, that with Lazarus 2.0.8 everything worked fine. I updated, because Lazarus 2.2.0 has LimitToExtent property for zooming chart, but now I am not able to use the program at all. I have no idea what to do... ---------------------------------------------------------------------- marcov · 2022-03-04 09:33 What happens when trying to run the exe  ? Security software is my first bet too. A missing DLL a second. (is this the same machine that 2.0.8 ran on?) ---------------------------------------------------------------------- dseligo · 2022-03-04 10:01 Quote from: Davidous on March 04, 2022, 09:59:05 amI have no idea what to do... Try debugging line by line and see where it stops. ---------------------------------------------------------------------- Davidous · 2022-03-04 10:53 I tried to run it before. There were many cases, when a window flashed in and disappeared in the same moment. Now it says "[HKb.YGraphToImage]: Image-graph scaling not yet initialized." HKb is a TAChart. I have more charts on a Form and at FormCreate I want to position them under one another. Earlier it worked. ---------------------------------------------------------------------- wp · 2022-03-04 12:08 Quote from: Davidous on March 04, 2022, 11:53:38 amI tried to run it before. There were many cases, when a window flashed in and disappeared in the same moment. Now it says "[HKb.YGraphToImage]: Image-graph scaling not yet initialized." HKb is a TAChart. I have more charts on a Form and at FormCreate I want to position them under one another. Earlier it worked. Without knowing what you are doing I guess that you are accessing some chart properties or methods too early. The chart usually must be painted so that the scaling coefficients are known. An  exception displaying the message that you mentioned was introduced about 2 years ago, i.e. before Laz 2.2.0, to notify of such a situation which can result in hard-to-predict errors. I have no idea why the exception message window is not persistent. Reorganize your code and move the critical parts to later events, such as OnActivate or OnShow. Or, alternatively, call Chart.Prepare after the charts have been set up and before calling the critical part which raises the exception. Sorry, I cannot be more specific because I don't know your code. ---------------------------------------------------------------------- Davidous · 2022-03-04 16:17 Thank you wp! The Chart.Prepare thing solved the problem. However the charts look entirely different then with Lazarus 2.0.8. On picture 1 you can see how the charts should look like. So far I had no problems with this. You can see on picture 2 how they look like when I run the compiled exe. ---------------------------------------------------------------------- wp · 2022-03-04 16:49 Quote from: Davidous on March 04, 2022, 05:17:27 pmHowever the charts look entirely different then with Lazarus 2.0.8. Then still something is wrong. Without sources I cannot help you. Please remove everything which is not needed from the project (make a backup copy first, of course), and upload the .pas, .lfm, .lpr, .lpi and maybe a data file, packaged to a single zip, to the forum. ---------------------------------------------------------------------- Davidous · 2022-03-04 18:01 Sorry, I cannot do that because it is a very complex project, that I made for the company where I work. Please answer one more question: I see, that there are many notes next to the lines that should do the formatting of the charts: Call to subroutine "..." marked as inline is not inlined. Can this cause the problem? What does this mean? ---------------------------------------------------------------------- Thaddy · 2022-03-04 18:04 No that message can not cause the problem. It means just that the code can not be inlined. For normal code this is harmless. Inlining code is just speed (a bit) If you are REALLY sure your code works on one machine and not on others then it is simply a dependency issue. ---------------------------------------------------------------------- Josh · 2022-03-04 18:13 hi try moving all your code you have in youf form.oncreate event to a seperate procedure ie. DoThisCodeFirst, then comment out your existing code in the oncreate event, now call the DoThisCodefirst in your on activate event; using a global var to stop calling it twice. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i type   { TForm1 }   TForm1 = class(TForm)    procedure FormActivate(Sender: TObject);    procedure FormCreate(Sender: TObject);  private   public    procedure DoThisCodeFirst;  end; var  Form1: TForm1;  FActivated:Boolean=false; implementation {$R *.lfm} { TForm1 } procedure Tform1.DoThisCodeFirst;begin  if not FActivated then  begin    Factivated:=True;    // all code from oncreate event    .....    .....   end;end; procedure TForm1.FormActivate(Sender: TObject);begin  DoThisCodeFirst;end; procedure TForm1.FormCreate(Sender: TObject);begin   // Comment out all code   {   .......   ......   }end; ---------------------------------------------------------------------- wp · 2022-03-04 18:13 Quote from: Davidous on March 04, 2022, 07:01:06 pmSorry, I cannot do that because it is a very complex project, that I made for the company where I work. No, I don't need the full project. Only the form with the charts. Fill the chart with dummy data (y = x, or similar). Remove all the calculations that you do for your company or replace them by some trivial stuff. Rename all identifiers that exhibit anything related to your company to some neutral ones. Remove all controls not related to the chart problem. Make sure that the issue still exists with that stripped-down project. I know that this will take some time, but without any code I cannot help you. ---------------------------------------------------------------------- Davidous · 2022-03-04 19:21 I managed to make a skeleton version of the project. There are some buttons left but they don't do anything. If you compile the project and open it, you will see that the charts look not the same as they were designed... Thank you for  checking it! ---------------------------------------------------------------------- wp · 2022-03-04 19:53 Quote from: Davidous on March 04, 2022, 08:21:40 pmIf you compile the project and open it, you will see that the charts look not the same as they were designed... To me the charts look the same as in design mode and exactly like in your screenshot 1.jpg posted above. And when I remove all the chart.Prepare lines I still do not get the crash that you report, and the charts do not change in this case either. So, something is wrong with the demo. BTW, why do you overlay the charts in such a strange way? For example you could put four charts into a panel and distribute the charts evenly within the panel by using the ChildSizing properties of the panel. ---------------------------------------------------------------------- Josh · 2022-03-04 20:07 Hi not checked to see if your code is doing any resizing, but something is off. in designeer mode i get pic 1, when run it has increased in size. pic 2 ---------------------------------------------------------------------- Davidous · 2022-03-04 20:23 Strange... For me the demo gives the same result. As for the strange overlapping... I learned everything from the internet on my own and I could find out this way to do it. I installed this version: lazarus-2.2.0-fpc-3.2.2-win64 Did you use the same? ---------------------------------------------------------------------- wp · 2022-03-04 20:39 Quote from: Davidous on March 04, 2022, 09:23:46 pmI installed this version: lazarus-2.2.0-fpc-3.2.2-win64 Did you use the same? Yes. And Laz2.2.0/FPC3.2.2/32 bit, and Laz-main/FPC3.2.2/32bit ---------------------------------------------------------------------- Davidous · 2022-03-04 20:40 I see now your picture. For me the charts are evenly distributed, not overlapping. Is something wrong with my lazarus version? I downloaded it from sourceforge if I remember correctly. ---------------------------------------------------------------------- Davidous · 2022-03-04 20:45 I have no idea then. I think I need to go back to version 2.0.8, because it worked like I wanted. Thank you guys for trying to help! ---------------------------------------------------------------------- Davidous · 2022-03-04 21:08 I reinstalled Lazarus 2.0.8. My application looks normal now. But if I compile the same project with Laz 2.2 then it's not working... ---------------------------------------------------------------------- wp · 2022-03-04 21:25 What is strange in your layout is that the charts overlap. In the attached screenshot I displaced the charts laterally so that it is visible that the axes cover only a small part of the entire charts, and the empty area is covered by the next chart which - in turn - uses only part of its area, etc. Why are you doing this? The other question is: why do you use the graph-to-image transformation to calculate the chart position? Although I cannot reproduce it, calling these transformations too early is critical. I am rather sure that this is the source of your problem, and I'd prefer to avoid it altogether. I'd propose that you reset the LabelSize of the bottom axis to zero in order to completely fill the chart by the axes. Adjust the height of the charts as needed. And put the individual charts into a panel, and top-align them (Align = alTop). This way the individual charts are adjacent to each other without any calculation. You can adjust their BorderSpacing.Top/.Bottom if you want some additional separation. ---------------------------------------------------------------------- Davidous · 2022-03-05 06:14 I will try what you suggest. ---------------------------------------------------------------------- WooBean · 2022-03-05 09:26 I set in project1 settings: use LCL scalling (Hi-DPI) = true, use different DPI = On(True). Both views run and design look similarly. ---------------------------------------------------------------------- Davidous · 2022-03-05 09:30 I bypassed graph-to-image transformations as wp suggested, now the charts look normal at runtime too. Thank you!