Recent

Author Topic: Lazarus / iPad / Xcode 7  (Read 11972 times)

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: Lazarus / iPad / Xcode 7
« Reply #15 on: May 04, 2016, 10:34:23 pm »
Them I'm afraid it won't really work.
There's no LCL-iOS, so you'll need to rework at least user-interface part.

madref

  • Hero Member
  • *****
  • Posts: 949
  • ..... A day not Laughed is a day wasted !!
    • Nursing With Humour
Re: Lazarus / iPad / Xcode 7
« Reply #16 on: May 04, 2016, 10:40:43 pm »
eeuuuhhhh.... how do i do that?
You treat a disease, you win, you lose.
You treat a person and I guarantee you, you win, no matter the outcome.

Lazarus 3.99 (rev main_3_99-649-ge13451a5ab) FPC 3.3.1 x86_64-darwin-cocoa
Mac OS X Monterey

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Lazarus / iPad / Xcode 7
« Reply #17 on: May 04, 2016, 11:05:45 pm »
eeuuuhhhh.... how do i do that?

Too bad someone didn't tell you up front that LCL was a deadend for iOS.

Not sure what to suggest.

Does your app have a large amount of non-UI code? If so, you could put it into a library framework, then re-do your UI, say in Swift in Xcode, and call your library from the UI code. That would allow you to preserve your non-UI Pascal code and re-use it in more than one place. However, if you have a small or modest amount of non-UI code, or if your non-UI code is all mixed up with your UI code, then I would not bother trying to do that - just rewrite from scratch, perhaps in Swift.

Pascal dynamic library info and Swift UI / Pascal library example (albeit for OS X, not iOS) are here:

https://dl.dropboxusercontent.com/u/28343282/MacXPlatform/PascalDynLibs.html

You could also post a question on the MacPascal mailing list. There may be someone there doing iOS work with FPC who doesn't monitor this list:

https://lists.sonic.net/mailman/listinfo/mac-pascal

Note that it's very unlikely that you will be able to use any of your LCL code, its design, or logic, regardless of what approach you decide on.

Also, what database are you using? iOS includes Sqlite, although a built-in database in your app can also work.

-Phil

madref

  • Hero Member
  • *****
  • Posts: 949
  • ..... A day not Laughed is a day wasted !!
    • Nursing With Humour
Re: Lazarus / iPad / Xcode 7
« Reply #18 on: May 04, 2016, 11:43:01 pm »
The big problem is that i don't know the language of Xcode (Swift or C).
Thats why i am using lazarus.
Until 2 years back i was a windows user and used embarcadero Delphi XE5 as my main programming language.
I have grown up with Turbo Pascal, Modula-2 and all Delphi variant. Never bothered to learn C.


And yes i have a lot of LCL code (units LCLType & LCLIntF)


The database has been build on SQLite so thats covered.


Here is just one of my units declaration
Code: Pascal  [Select][+][-]
  1.  
  2. type
  3.   { TForm_Evaluatie_Referee }
  4.   TForm_Evaluatie_Referee = class(TForm)
  5.     BT_EvaluatieCancel: TButton;
  6.     BT_EvaluatieOk: TButton;
  7.     BT_EvaluatieUpdate: TButton;
  8.     CB_Divisie: TDBLookupComboBox;
  9.     CB_CD1x1: TCheckBox;    CB_CD1x2: TCheckBox;    CB_CD1x3: TCheckBox;
  10.     CB_CD1x4: TCheckBox;    CB_CD1x5: TCheckBox;    CB_CD1x6: TCheckBox;
  11.     CB_CD1x7: TCheckBox;    CB_CD1x8: TCheckBox;    CB_CD1x9: TCheckBox;
  12.     CB_CD2x1: TCheckBox;    CB_CD2x2: TCheckBox;    CB_CD2x3: TCheckBox;
  13.     CB_CD2x4: TCheckBox;    CB_CD2x5: TCheckBox;    CB_CD2x6: TCheckBox;
  14.     CB_CD2x7: TCheckBox;    CB_CD2x8: TCheckBox;    CB_CD2x9: TCheckBox;
  15.     CB_CD3x1: TCheckBox;    CB_CD3x2: TCheckBox;    CB_CD3x3: TCheckBox;
  16.     CB_CD3x4: TCheckBox;    CB_CD3x5: TCheckBox;    CB_CD3x6: TCheckBox;
  17.     CB_CD3x7: TCheckBox;    CB_CD3x8: TCheckBox;    CB_CD3x9: TCheckBox;
  18.     CB_CD4x1: TCheckBox;    CB_CD4x2: TCheckBox;    CB_CD4x3: TCheckBox;
  19.     CB_CD4x4: TCheckBox;    CB_CD4x5: TCheckBox;    CB_CD4x6: TCheckBox;
  20.     CB_CD4x7: TCheckBox;    CB_CD4x8: TCheckBox;    CB_CD4x9: TCheckBox;
  21.     CB_CD5x1: TCheckBox;    CB_CD5x2: TCheckBox;    CB_CD5x3: TCheckBox;
  22.     CB_CD5x4: TCheckBox;    CB_CD5x5: TCheckBox;    CB_CD5x6: TCheckBox;
  23.     CB_CD5x7: TCheckBox;    CB_CD5x8: TCheckBox;    CB_CD5x9: TCheckBox;
  24.     CB_CD6x1: TCheckBox;    CB_CD6x2: TCheckBox;    CB_CD6x3: TCheckBox;
  25.     CB_CD6x4: TCheckBox;    CB_CD6x5: TCheckBox;    CB_CD6x6: TCheckBox;
  26.     CB_CD6x7: TCheckBox;    CB_CD6x8: TCheckBox;    CB_CD6x9: TCheckBox;
  27.     CB_CD7x1: TCheckBox;    CB_CD7x2: TCheckBox;    CB_CD7x3: TCheckBox;
  28.     CB_CD7x4: TCheckBox;    CB_CD7x5: TCheckBox;    CB_CD7x6: TCheckBox;
  29.     CB_CD7x7: TCheckBox;    CB_CD7x8: TCheckBox;    CB_CD7x9: TCheckBox;
  30.     CB_CD8x1: TCheckBox;    CB_CD8x2: TCheckBox;    CB_CD8x3: TCheckBox;
  31.     CB_CD8x4: TCheckBox;    CB_CD8x5: TCheckBox;    CB_CD8x6: TCheckBox;
  32.     CB_CD8x7: TCheckBox;    CB_CD8x8: TCheckBox;    CB_CD8x9: TCheckBox;
  33.     CB_CD9x1: TCheckBox;    CB_CD9x2: TCheckBox;    CB_CD9x3: TCheckBox;
  34.     CB_CD9x4: TCheckBox;    CB_CD9x5: TCheckBox;    CB_CD9x6: TCheckBox;
  35.     CB_CD9x7: TCheckBox;    CB_CD9x8: TCheckBox;    CB_CD9x9: TCheckBox;
  36.     CB_GD1x1: TCheckBox;    CB_GD1x2: TCheckBox;    CB_GD1x3: TCheckBox;
  37.     CB_GD1x4: TCheckBox;    CB_GD1x5: TCheckBox;    CB_GD1x6: TCheckBox;
  38.     CB_GD1x7: TCheckBox;    CB_GD1x8: TCheckBox;    CB_GD1x9: TCheckBox;
  39.     CB_PC1x1: TCheckBox;    CB_PC1x2: TCheckBox;    CB_PC1x3: TCheckBox;
  40.     CB_PC1x4: TCheckBox;    CB_PC1x5: TCheckBox;    CB_PC1x6: TCheckBox;
  41.     CB_PC1x7: TCheckBox;    CB_PC1x8: TCheckBox;    CB_PC1x9: TCheckBox;
  42.     CB_PC2x1: TCheckBox;    CB_PC2x2: TCheckBox;    CB_PC2x3: TCheckBox;
  43.     CB_PC2x4: TCheckBox;    CB_PC2x5: TCheckBox;    CB_PC2x6: TCheckBox;
  44.     CB_PC2x7: TCheckBox;    CB_PC2x8: TCheckBox;    CB_PC2x9: TCheckBox;
  45.     CB_PC3x1: TCheckBox;    CB_PC3x2: TCheckBox;    CB_PC3x3: TCheckBox;
  46.     CB_PC3x4: TCheckBox;    CB_PC3x5: TCheckBox;    CB_PC3x6: TCheckBox;
  47.     CB_PC3x7: TCheckBox;    CB_PC3x8: TCheckBox;    CB_PC3x9: TCheckBox;
  48.     CB_PC4x1: TCheckBox;    CB_PC4x2: TCheckBox;    CB_PC4x3: TCheckBox;
  49.     CB_PC4x4: TCheckBox;    CB_PC4x5: TCheckBox;    CB_PC4x6: TCheckBox;
  50.     CB_PC4x7: TCheckBox;    CB_PC4x8: TCheckBox;    CB_PC4x9: TCheckBox;
  51.     CB_Scheids: TDBLookupComboBox;
  52.     CB_Seizoen: TDBLookupComboBox;
  53.     CB_Supervisor: TDBLookupComboBox;
  54.     CB_Systeem: TDBLookupComboBox;
  55.     CB_TeamA: TDBLookupComboBox;
  56.     CB_TeamB: TDBLookupComboBox;
  57.     DateTimePicker_Tijd: TDateTimePicker;
  58.     DateTimePicker_Datum: TDateTimePicker;
  59.     DBM_Opmerkingen1: TDBMemo;
  60.     DBM_Opmerkingen2: TDBMemo;
  61.     DBM_Opmerkingen3: TDBMemo;
  62.     DB_GameDif: TDBEdit;
  63.     DB_PenCon1: TDBEdit;    DB_PenCon2: TDBEdit;
  64.     DB_PenCon3: TDBEdit;    DB_PenCon4: TDBEdit;
  65.     DB_CatDef1: TDBEdit;    DB_CatDef2: TDBEdit;    DB_CatDef3: TDBEdit;
  66.     DB_CatDef4: TDBEdit;    DB_CatDef5: TDBEdit;    DB_CatDef6: TDBEdit;
  67.     DB_CatDef7: TDBEdit;    DB_CatDef8: TDBEdit;    DB_CatDef9: TDBEdit;
  68.     DB_WedID: TDBEdit;
  69.     DB_WedID1: TDBEdit;
  70.     DS_Divisie: TDataSource;
  71.     DS_Evaluatie: TDataSource;
  72.     DS_Referee: TDataSource;
  73.     DS_Seizoen: TDataSource;
  74.     DS_Supervisors: TDataSource;
  75.     DS_Teams: TDataSource;
  76.     Edit_GTA_P1: TDBEdit;    Edit_GTA_P2: TDBEdit;    Edit_GTA_P3: TDBEdit;
  77.     Edit_GTA_P4: TDBEdit;    Edit_GTA_P5: TDBEdit;
  78.     Edit_GTB_P1: TDBEdit;    Edit_GTB_P2: TDBEdit;    Edit_GTB_P3: TDBEdit;
  79.     Edit_GTB_P4: TDBEdit;    Edit_GTB_P5: TDBEdit;
  80.     Edit_PC_MI1: TDBEdit;    Edit_PC_MI2: TDBEdit;
  81.     Edit_PC_MP1: TDBEdit;    Edit_PC_MP2: TDBEdit;
  82.     Edit_STA_P1: TDBEdit;    Edit_STA_P2: TDBEdit;    Edit_STA_P3: TDBEdit;
  83.     Edit_STA_P4: TDBEdit;    Edit_STA_P5: TDBEdit;
  84.     Edit_STB_P1: TDBEdit;    Edit_STB_P2: TDBEdit;    Edit_STB_P3: TDBEdit;
  85.     Edit_STB_P4: TDBEdit;    Edit_STB_P5: TDBEdit;
  86.     GroupBox_Categorien: TGroupBox;
  87.     GroupBox_Extra1: TGroupBox;
  88.     GroupBox_Extra2: TGroupBox;
  89.     GroupBox_Extra3: TGroupBox;
  90.     GroupBox_GameDificulty: TGroupBox;
  91.     GroupBox_Penalties: TGroupBox;
  92.     GroupBox_Periodes: TGroupBox;
  93.     GroupBox_Standaard: TGroupBox;
  94.     GroupBox_Wedstrijd: TGroupBox;
  95.     Image_Shirt_Referee: TImage;
  96.     lbl_Beoordeling1: TLabel;
  97.     lbl_Beoordeling2: TLabel;
  98.     lbl_Beoordeling3: TLabel;
  99.     lbl_Beoordeling4: TLabel;
  100.     lbl_Beoordeling5: TLabel;
  101.     lbl_Beoordeling6: TLabel;
  102.     lbl_Beoordeling7: TLabel;
  103.     lbl_Beoordeling8: TLabel;
  104.     lbl_Beoordeling9: TLabel;
  105.     lbl_Datum: TLabel;
  106.     lbl_Divisie: TLabel;
  107.     lbl_Goals_TeamA: TLabel;
  108.     lbl_Goals_TeamB: TLabel;
  109.     lbl_Moeilijkheid: TLabel;
  110.     lbl_PeriodeG1A: TLabel;    lbl_PeriodeG2A: TLabel;    lbl_PeriodeG3A: TLabel;
  111.     lbl_PeriodeG4A: TLabel;    lbl_PeriodeG5A: TLabel;
  112.     lbl_PeriodeG1B: TLabel;    lbl_PeriodeG2B: TLabel;    lbl_PeriodeG3B: TLabel;
  113.     lbl_PeriodeG4B: TLabel;    lbl_PeriodeG5B: TLabel;
  114.     lbl_PeriodeS1A: TLabel;    lbl_PeriodeS2A: TLabel;    lbl_PeriodeS3A: TLabel;
  115.     lbl_PeriodeS4A: TLabel;    lbl_PeriodeS5A: TLabel;
  116.     lbl_PeriodeS1B: TLabel;    lbl_PeriodeS2B: TLabel;    lbl_PeriodeS3B: TLabel;
  117.     lbl_PeriodeS4B: TLabel;    lbl_PeriodeS5B: TLabel;
  118.     lbl_PuntG1: TLabel;        lbl_PuntG2: TLabel;
  119.     lbl_PuntS1: TLabel;        lbl_PuntS2: TLabel;        lbl_PuntS3: TLabel;
  120.     lbl_PuntU1: TLabel;        lbl_PuntU2: TLabel;        lbl_PuntU3: TLabel;
  121.     lbl_PuntV1: TLabel;        lbl_PuntV2: TLabel;        lbl_PuntV3: TLabel;
  122.     lbl_Standaard1: TLabel;    lbl_Standaard2: TLabel;    lbl_Standaard3: TLabel;
  123.     lbl_Standaard4: TLabel;    lbl_Standaard5: TLabel;    lbl_Standaard6: TLabel;
  124.     lbl_Standaard7: TLabel;    lbl_Standaard8: TLabel;
  125.     lbl_Scheids: TLabel;
  126.     lbl_Seizoen: TLabel;
  127.     lbl_Straf_TeamA: TLabel;
  128.     lbl_Straf_TeamB: TLabel;
  129.     lbl_Supervisor: TLabel;
  130.     lbl_Systeem: TLabel;
  131.     lbl_TeamA: TLabel;
  132.     lbl_TeamB: TLabel;
  133.     Panel_Divider1: TPanel;
  134.     Panel_Divider2: TPanel;
  135.     Panel_Divider3: TPanel;
  136.     TQ_Divisie: TSQLQuery;
  137.     TQ_Evaluatie: TSQLQuery;
  138.     TQ_Referee: TSQLQuery;
  139.     TQ_Seizoen: TSQLQuery;
  140.     TQ_Supervisors: TSQLQuery;
  141.     TQ_Teams: TSQLQuery;
  142.     procedure BerekenTotaalPenalties(Sender: TObject);
  143.     procedure BerekenTotaalScore(Sender: TObject);
  144.     procedure BT_EvaluatieCancelClick(Sender: TObject);
  145.     procedure BT_EvaluatieOkClick(Sender: TObject);
  146.     procedure BT_EvaluatieUpdateClick(Sender: TObject);
  147.     procedure CB_CD_Click(Sender: TObject);
  148.     procedure CB_GD_Click(Sender: TObject);
  149.     procedure CB_PC_Click(Sender: TObject);
  150.     procedure DS_EvaluatieStateChange(Sender: TObject);
  151.     procedure FormClose(Sender: TObject);
  152.     procedure FormShow(Sender: TObject);
  153.   private
  154.     { private declarations }
  155.     function CheckInput: Boolean;
  156.     procedure UpdateEvaluatieReferee;
  157.   public
  158.     { public declarations }
  159.     procedure ShowEvaluatieReferee (ID, WID: integer);
  160.   end;
  161.  
You treat a disease, you win, you lose.
You treat a person and I guarantee you, you win, no matter the outcome.

Lazarus 3.99 (rev main_3_99-649-ge13451a5ab) FPC 3.3.1 x86_64-darwin-cocoa
Mac OS X Monterey

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: Lazarus / iPad / Xcode 7
« Reply #19 on: May 05, 2016, 05:43:35 am »
You don't have to learn wither Objective C or Swift, but you'll need to understand them (at least samples given in Apple documention), and that's not hard at all.

You definitely want to get acquainted with Xcode User Interface. It potentially could be used with pascal code.

Since you're coming from Delphi XE background, you might think that Lazarus is similar to Firemonkey. Where FMX works the same on every platform (and iOS specifically). Unfortunately, it's not the case for Lazarus.

madref

  • Hero Member
  • *****
  • Posts: 949
  • ..... A day not Laughed is a day wasted !!
    • Nursing With Humour
Re: Lazarus / iPad / Xcode 7
« Reply #20 on: May 05, 2016, 08:26:28 am »
do you have any good pages for that?
That is on how to start?

You treat a disease, you win, you lose.
You treat a person and I guarantee you, you win, no matter the outcome.

Lazarus 3.99 (rev main_3_99-649-ge13451a5ab) FPC 3.3.1 x86_64-darwin-cocoa
Mac OS X Monterey

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Lazarus / iPad / Xcode 7
« Reply #21 on: May 06, 2016, 10:34:22 pm »
Perhaps a first step would be to review your app's code and see what can be salvaged for use on iOS. This exercise is useful anytime you're considering changing a Laz app's UI (eg, to make it a mobile app or a Web app or a non-LCL app).

Estimate what percentage of your code is UI and what's non-UI. In this case, UI code is any unit that depends on the LCL or on any component or unit which in turn depends on the LCL. Look in the Laz lcl folder to see all the units that make up the LCL. That is, if you can compile a unit with FPC without needing the LCL present on your computer, then it's probably a candidate for being considered UI independent.

For example, in one of my legacy desktop apps, I have 17 .dfm form files (with corresponding .pas files) and 28 non-UI .pas units. The form units constitute a bit less than 30% of the code. I'm counting any non-blank line as a line of code, including comments since they would need to be rewritten as well.

Obviously this percentage will not be constant across desktop apps; the percentage of UI code will vary depending on how complex the UI is vs. how complex the non-UI is. But I would think that you should never see a UI percentage greater than, say, 40-50%. If you do, that probably means that you've hopelessly entangled the UI and non-UI code. The only recourse would probably be to start over from scratch on the new platform.

As we move away from desktop apps and toward mobile apps and Web apps, the non-UI code becomes more and more valuable and thus its percentage of an app's code should be maximized, for example by moving bits of code that don't depend on LCL out of the form units.

-Phil

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: Lazarus / iPad / Xcode 7
« Reply #22 on: May 06, 2016, 10:36:35 pm »
do you have any good pages for that?
That is on how to start?
They should appear in the near future (over this weekend). I'm finishing the update of iphonelazextension (to be friendly with Xcode7) and I'm planning to add some project templates and examples with it.

 

TinyPortal © 2005-2018