Recent

Author Topic: Is TAChart portable to Cocoa?  (Read 3411 times)

AL

  • Sr. Member
  • ****
  • Posts: 264
Is TAChart portable to Cocoa?
« on: January 07, 2020, 04:28:18 am »
I have a Windows application that I am trying to port to MacOS.
It uses TAChart. I am cross-compiling in Windows10  to cocoa.
The code compile fine, but whe I run the program (in a VMware machine), the charts are inverted left-right and up-down. So they are like mirror image.  How can I resolve this?

My charts are tlineseries if that make a difference

Thank you.
 
« Last Edit: January 07, 2020, 04:39:43 am by AL »
Laz 3.1, fpc 3.2.2, Win10
Laz 3.1  fpc 3.2.2, MacOS Monterey running on VMWare/Win 10
Laz 3.1  fpc 3.2.2 Ubuntu 20.04

wp

  • Hero Member
  • *****
  • Posts: 13328
Re: Is TAChart portable to Cocoa?
« Reply #1 on: January 07, 2020, 10:18:09 am »
I don't have access to a Mac, so I cannot provide specific help. But there is a similar topic about a flipped TreeView (https://forum.lazarus.freepascal.org/index.php/topic,47675.msg341943.html#msg341943) - maybe this can help. Please report back if this could solve the issue, and what you exactly did to solve the issue so that I can include it in TAChart.

AL

  • Sr. Member
  • ****
  • Posts: 264
Re: Is TAChart portable to Cocoa?
« Reply #2 on: January 07, 2020, 02:37:48 pm »
You mean nobody has used a Tchart in MacOs up to now?
Laz 3.1, fpc 3.2.2, Win10
Laz 3.1  fpc 3.2.2, MacOS Monterey running on VMWare/Win 10
Laz 3.1  fpc 3.2.2 Ubuntu 20.04

nsl

  • New Member
  • *
  • Posts: 16
Re: Is TAChart portable to Cocoa?
« Reply #3 on: January 07, 2020, 04:30:52 pm »
I had an application using TAChart working a few months ago. I just recompiled and with a few changes to do with crt1.10.5 I got it working with MacOS 10.14.6 with Cocoa.

Also copied the TAChart test application 'Basic' from the lazarus/components/tachart/demo folder and compiled this after changing target CPU and widgetset. Got this working with no sign of axis inversion.

All of this with Lazarus 2.1.0 rev 61787.

Not the latest version so this may be a problem
Lazarus 2.1 on Windows 10 / macOS Mojave

wp

  • Hero Member
  • *****
  • Posts: 13328
Re: Is TAChart portable to Cocoa?
« Reply #4 on: January 07, 2020, 04:44:35 pm »
TAChart uses simple TCanvas drawing commands. Can you reproduce the issue with something like this? Add a Paintbox to a form and assign this OnPaint handler to it:
Code: Pascal  [Select][+][-]
  1. procedure TForm1.Paintbox1Paint(Sender: TObject);
  2. begin
  3.   Paintbox1.Canvas.Line(0, 0, Paintbox1.Width, Paintbox1.Height);
  4. end;
The line should run from top-left to right-bottom. if it does not you should write a bugreport and add this project as an example. You could also find out the exact breaking revision. Update your svn to a revision half-way between the last working and the current revision. if this intermediate revision is working go forward half-way to the latest non-working revision, if not go back half-way to the latest working revision, etc. After a few iterations you will have found the guilty revision.

AL

  • Sr. Member
  • ****
  • Posts: 264
Re: Is TAChart portable to Cocoa?
« Reply #5 on: January 07, 2020, 10:29:56 pm »
Will try that thank you.
I set my target OS as Darwin is that OK.  I see there is also MAcOS in the list.


UPDATE: 

tried your sample and it works OK.  Nice line like that:   \

Now: I was surprised to see that my executable file had no extention (as should be in MacOS).
When I compile MY program I always get a file with EXE extention that I have to remove!!!
Also My program in windows has about 30 Mb and in MacOS it is about 10 Mb.  I was surprised of that.
I will go through the settings again trying to find what I did wrong.
Any idea what could cause that?  Compiler directive like objectivec, etc.

« Last Edit: January 07, 2020, 10:47:43 pm by AL »
Laz 3.1, fpc 3.2.2, Win10
Laz 3.1  fpc 3.2.2, MacOS Monterey running on VMWare/Win 10
Laz 3.1  fpc 3.2.2 Ubuntu 20.04

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2032
  • Former Delphi 1-7, 10.2 user
Re: Is TAChart portable to Cocoa?
« Reply #6 on: January 08, 2020, 01:06:21 am »
I set my target OS as Darwin is that OK.  I see there is also MAcOS in the list.

MacOS is for "Classic MacOS" (starting with System 1 in 1984 and ending with Mac OS 9 in 2001). Darwin is for "macOS" (formerly marketed as Mac OS X and OS X). Do not confuse MacOS and macOS :)

AL

  • Sr. Member
  • ****
  • Posts: 264
Re: Is TAChart portable to Cocoa?
« Reply #7 on: January 08, 2020, 01:13:58 am »
Is it possible to copy and paste a tachart from one form to another?
Laz 3.1, fpc 3.2.2, Win10
Laz 3.1  fpc 3.2.2, MacOS Monterey running on VMWare/Win 10
Laz 3.1  fpc 3.2.2 Ubuntu 20.04

AL

  • Sr. Member
  • ****
  • Posts: 264
Re: Is TAChart portable to Cocoa?
« Reply #8 on: January 08, 2020, 04:17:59 am »
I do not want to cross-post, but in another thread I posted this.
It look like TAChart is OK, but something is flipping it in a mirror image.
       

Re: Help: How to run a Windows cross-compiled program on a MacOS
« Reply #14 on: Today at 04:14:01 am »

   
Made a new test:

Created a new project.
Copy and Paste one chart and one button from my program.
Compiled and tested on the VM MAC: Everything look fine.

I deduct that it is one of the unit I use that throws things in mirror image for some reason.
That will be tough to find!

Here are the units I use in my main unit:

USES
{$IFDEF DARWIN} CocoaAll,MacOSALL, {$ENDIF}
{$IFDEF WINDOWS}   Windows, MMSystem {$ENDIF}

 Interfaces,SysUtils, Classes, Graphics, Forms, StdCtrls, ComCtrls, Grids,
  ExtCtrls, Dialogs, Menus, TAGraph, TASeries, TACustomSeries,
  TACustomSource, TATools, Types, TAChartUtils, TaPrint, ]"]>BlockedltiSeries,
  PrintersDlgs, Printers, LCLType, Buttons, LCLTranslator,
  controls, LCLIntf,  TADataTools, TAChartListbox , Math, LazUtils;       

Anyone see something obvious?

Do I need to use Cthreads with Darwin?
« Last Edit: January 28, 2020, 08:37:29 pm by AL »
Laz 3.1, fpc 3.2.2, Win10
Laz 3.1  fpc 3.2.2, MacOS Monterey running on VMWare/Win 10
Laz 3.1  fpc 3.2.2 Ubuntu 20.04

wp

  • Hero Member
  • *****
  • Posts: 13328
Re: Is TAChart portable to Cocoa?
« Reply #9 on: January 08, 2020, 10:45:59 am »
Is it possible to copy and paste a tachart from one form to another?
In principle yes. It will copy the chart and series. But TAChart components like sources, transformations, styles, etc. are not copied automatically along with the chart and must be copied and re-linked separately.

nsl

  • New Member
  • *
  • Posts: 16
Re: Is TAChart portable to Cocoa?
« Reply #10 on: January 08, 2020, 11:32:40 am »
AL, trev - apologies for confusing macOS and MacOS. In the project settings for my projects the 'Target OS' is set to '(default)' which must resolve to 'Darwin'.

AL - In my projects I have not needed to use any mac specific includes (e.g.  MacOSALL). All calls to mac-specific code must be through the LCL.
Lazarus 2.1 on Windows 10 / macOS Mojave

AL

  • Sr. Member
  • ****
  • Posts: 264
Re: Is TAChart portable to Cocoa?
« Reply #11 on: January 08, 2020, 06:51:03 pm »
I cannot reproduce the problem except when using my original project.
Every new test project that I try is OK.
Laz 3.1, fpc 3.2.2, Win10
Laz 3.1  fpc 3.2.2, MacOS Monterey running on VMWare/Win 10
Laz 3.1  fpc 3.2.2 Ubuntu 20.04

 

TinyPortal © 2005-2018