Smart Mobile Studio Version Differences

Introduction

In Version 2.2 Beta 5 of Smart Mobile Studio, the units are external by default. This means that if you (1) keep your projects in the same folder, (2) do not change the default unit name from Unit1 and (3) do not heed the warning then you will overwrite the unit of another project when you save the current project. In order to save the Unit1 contents instead within the .dproj project file, right click on Unit1 in the Project Manager and select the option Make Item Internal.

Version 2.1 has newly named inbuilt units and in a canvas game application the class TApplication becomes TCanvasProject. Some of our existing demonstrations and programs use the old unit names and our new ones and revisions were developed using Version 2.1 or later.

If you are still using Version 2.0 and want to use code from new demonstrations, start a new project of the appropriate type and copy variable declarations and bodies of procedures from the demonstrations into the corresponding places in your new project. You must keep the old names of inbuilt units in the uses clause.

If you are using Version 2.1 and want to use demonstration code from an earlier version, follow these steps (which use Motion1 as an example).

  1. Start a new Canvas Project.
  2. Select menu item File > Save Project As.
  3. Save the project as ProjectMotion1.sprog
  4. Select menu item File > Save as.
  5. Save the file as Motion1.pas.
  6. Select the contents with CTRL+A.
  7. Select the code of Motion1 and copy it with CTRL+C.
  8. Paste the copied code into the Smart Mobile Studio editor to replace the existing code (CTRL+V).
  9. Compile the project (CTRL+F9) to highlight 2 errors in the application page:
    Errors in Application Unit

    Errors in Application Unit

  10. If necessary, change the first line to uses Motion1 as shown in the screenshot.
  11. Change TCanvasProject to TApplication (as it was in Version 2.0) in both places.
  12. Execute the project (F9).

If you have problems with compilation, another approach is to open ProjectMotion1.sprog in a text editor such as Notepad++ and look for any inconsistencies in names of variables, classes and files.

Either ignore any messages such as Warning: "W3GameApp" has been deprecated: Use SmartCL.GameApp instead or change the unit names as instructed.

Visual Components Project

The source view of a form now has an initialization section to register the form. Take care to leave this in place if you are copying old code into a Version 2.1 project. (Without it the code will compile, but upon execution of the JavaScript you will see the error message "ClassType is nil").

Those of you interested in 3D graphics should note that the old W3C.WebGL unit becomes Khronos.WebGL. See this section of Displaying a Rectangle for WebGL code to go with the new TW3WebGL component.

The remainder of this page gives specific examples of changes.

Canvas Game Application

It is important to note that the class TApplication in Version 2 becomes TCanvasProject in Version 2.1. This means that, if you do not edit the application unit as described in Step 11 above, the procedure names in the implementation section must have the prefix TCanvasProject. instead of TApplication.

//Version 2.0 
uses 
  W3System, W3Components, W3Application, W3Game, W3GameApp, W3Graphics;

type
  TApplication = class(TW3CustomGameApplication)
	
//Version 2.1 Canvas Project
uses 
  System.Types, SmartCL.System, SmartCL.Components, SmartCL.Application,
  SmartCL.Game, SmartCL.GameApp, SmartCL.Graphics;

type
  TCanvasProject = class(TW3CustomGameApplication)

Console Application

//Version 2.0 
uses 
  W3System, W3Scroll, W3Console, W3Components, W3Application, W3ConsoleApp, W3Lists;

type
  TApplication = class(TW3CustomConsoleApplication)
	
//Version 2.1
uses 
  System.Types, System.Lists, SmartCL.System, SmartCL.Scroll, SmartCL.Console,
  SmartCL.Components, SmartCL.Application, SmartCL.ConsoleApp;

type
  TApplication = class(TW3CustomConsoleApplication)	
	
    

Visual Components Project

//Version 2.0  
uses 
  W3System, W3Components, W3Forms, W3Application, Form1;

type
  TApplication = class(TW3CustomApplication)
	

//Version 2.1 
uses
  Pseudo.CreateForms, // auto-generated unit that creates forms during startup
  System.Types, SmartCL.System, SmartCL.Components, SmartCL.Forms, 
  SmartCL.Application, Form1;

type
  TApplication  = class(TW3CustomApplication)	
    

Note also that the XML view of the form has changed. For example, the first tag is now <SMART> instead of <SFM>

 

Programming - a skill for life!

Developing graphical web pages including 3D, input from keyboard and mouse and storing and loading data