Smart Mobile Studio Files

Introduction

This page shows the code of all of the files necessary to compile a bare forms project with external form and unit files with the command line compiler of Version 3.0. We find it more convenient to put all of the data into a single .proj file, as shown on the next page. You can find template forms in the Smart Mobile Studio download. Ours were in the folder C:\ProgramData\The Smart Company\Smart Mobile Studio\Repository\Template.

Code of project file BareProject.sproj

<SMART>
  <Project version="3" subversion="0">
    <Name>BareProject</Name>
    <VendorSpecific>
      <Apple>
        <FormatDetection>1</FormatDetection>
        <StatusBarStyle>default</StatusBarStyle>
        <WebAppCapable>1</WebAppCapable>
      </Apple>
      <ChromeApp>
        <Kiosk>0</Kiosk>
        <KioskOnly>1</KioskOnly>
        <OfflineEnabled>1</OfflineEnabled>
      </ChromeApp>
    </VendorSpecific>
    <Options>
      <Compiler>
        <Assertions>1</Assertions>
        <Optimize>1</Optimize>
        <HintsLevel>1</HintsLevel>
        <ProjectSearchPath></ProjectSearchPath>
      </Compiler>
      <Codegen>
        <Obfuscation>1</Obfuscation>
        <RangeChecking>0</RangeChecking>
        <InstanceChecking>0</InstanceChecking>
        <ConditionChecking>0</ConditionChecking>
        <LoopChecking>0</LoopChecking>
        <InlineMagics>1</InlineMagics>
        <IgnorePublishedInImplementation>0</IgnorePublishedInImplementation>
        <EmitSourceLocation>0</EmitSourceLocation>
        <EmitRTTI>0</EmitRTTI>
        <Devirtualize>1</Devirtualize>
        <MainBody>1</MainBody>
        <CodePacking>1</CodePacking>
        <SmartLinking>1</SmartLinking>
        <Verbosity>1</Verbosity>
      </Codegen>
      <ConditionalDefines>
        <HandleExceptions>1</HandleExceptions>
        <AutoRefresh>0</AutoRefresh>
        <LegacySupportForIE>0</LegacySupportForIE>
      </ConditionalDefines>
      <Linker>
        <SourceMap>0</SourceMap>
        <CompressCSS>0</CompressCSS>
        <GenerateAppCacheManifest>1</GenerateAppCacheManifest>
        <GenerateChromeAppManifest>0</GenerateChromeAppManifest>
        <GenerateFireFoxManifest>0</GenerateFireFoxManifest>
        <GenerateWebAppManifest>1</GenerateWebAppManifest>
        <GenerateWidgetPackageConfigXML>0</GenerateWidgetPackageConfigXML>
        <GenerateCordovaConfigXML>0</GenerateCordovaConfigXML>
        <ExternalCSS>0</ExternalCSS>
        <Theme>default.css</Theme>
        <CustomTheme>0</CustomTheme>
        <EmbedJavaScript>1</EmbedJavaScript>
      </Linker>
      <Output>
        <JavaScriptFileName>main.js</JavaScriptFileName>
        <HtmlFileName>BareProject.html</HtmlFileName>
        <OutputFilePath>www\</OutputFilePath>
      </Output>
      <Import />
      <Execute>
        <ServeManifest>0</ServeManifest>
        <Server>1</Server>
        <CustomFile></CustomFile>
        <LoadCustomFile>0</LoadCustomFile>
        <PauseAfterExecution>0</PauseAfterExecution>
        <ExecuteType>0</ExecuteType>
      </Execute>
      <WebFonts>
        <usewebfonts>1</usewebfonts>
        <webfontitem>
          <fontname>Ubuntu</fontname>
          <fonturl>https://fonts.googleapis.com/css?family=Ubuntu</fonturl>
        </webfontitem>
      </WebFonts>
    </Options>
    <Files>
      <File type="main">
        <Name>BareProject</Name>
        <Filename>BareProject.spr</Filename>
      </File>
      <File type="unit">
        <Name>BareProjectUnit1</Name>
        <Filename>BareProjectUnit1.pas</Filename>
      </File>
      <File type="form">
        <Name>BareProjectForm1</Name>
        <Filename>BareProjectForm1.pas</Filename>
        <AutoCreate>
          <IsAutoCreate>1</IsAutoCreate>
          <IsMainForm>1</IsMainForm>
          <Order>1</Order>
        </AutoCreate>
      </File>
    </Files>
    <Target>Browser</Target>
    <Generator>Visual Components Project</Generator>
  </Project>
</SMART>

Code of BareProject.spr

uses SmartCL.System, BareProjectUnit1, BareProjectForm1;

{$IFDEF SMART_INTERNAL_HANDLE_EXCEPTIONS}
try
{$ENDIF}
  var Application := TApplication.Create;
  Application.RunApp;
{$IFDEF SMART_INTERNAL_HANDLE_EXCEPTIONS}
except
  on e: Exception do
    ShowMessage(e.Message);
end;
{$ENDIF}    

Code of BareProjectForm1.sfm

<SMART>
  <Form version="3" subversion="0">
    <object type="TW3Form">
      <Caption>W3Form</Caption>
      <Name>BareProjectForm1</Name>      
    </object>
  </Form>
</SMART>

Code of BareProjectForm1.pas

unit BareProjectForm1;

interface

uses 
  System.Types, System.Types.Convert, System.Objects, System.Time,
  System.IOUtils, System.Device.Storage,
  SmartCL.System, SmartCL.Time, SmartCL.Graphics, SmartCL.Components,
  SmartCL.FileUtils, SmartCL.Device.Storage, SmartCL.Forms, SmartCL.Fonts,
  SmartCL.Theme, SmartCL.Borders, SmartCL.Application;

type
  BareProjectForm1 = class(TW3Form)
  private
    {$I 'BareProjectForm1:intf'}
  protected
    procedure InitializeForm; override;
    procedure InitializeObject; override;
  end;

implementation

procedure BareProjectForm1.InitializeForm;
begin
  inherited;
end;

procedure BareProjectForm1.InitializeObject;
begin
  inherited;
  {$I 'BareProjectForm1:impl'}
end;

initialization
  Forms.RegisterForm({$I %FILE%}, BareProjectForm1);
end.    

Code of BareProjectUnit1.pas

unit BareProjectUnit1;

interface

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

type
  TApplication  = class(TW3CustomApplication)
  end;

implementation

end.   
Programming - a skill for life!

Important differences between Versions 2.0, 2.1, 2.2Beta5 and 3.0