Smart Mobile Studio
  • News
  • Forums
  • Download
  • Store
  • Showcases
    • Featured demos
    • The Smart Contest 2013, Round 1 – Graphics
  • Documentation
    • Get the book
    • System requirements
    • Prerequisites
    • Getting started
      • Introduction
      • Application architecture
      • The application object
      • Forms and navigation
      • Message dialogs
      • Themes and styles
    • Project types
      • Visual project
      • Game project
      • Console project
    • Layout manager
    • Networking
      • TW3HttpRequest
      • TW3JSONP
      • Loading files
  • About

Smart Mobile Studio 3.9.1 is released

Posted on 20.12.2019 by Jarto Tarpio Posted in News

Smart Mobile Studio 3.9.1 is released

We are proud to release Smart Mobile Studio 3.9.1. This is the first Alpha release of the upcoming Smart Mobile Studio 4.0. The biggest improvement is the new WYSIWYG Designer, which takes developing visual applications in SMS to a new level. The compiler was updated with a new version of DWS (Delphi Web Script) and the IDE uses an updated Chromium component. On top of this, there are new components and improvements to the RTL.

We’ve attempted to keep this release as much backwards compatible as possible, so old projects should compile and run without changes.

The new Designer is written from scratch in Smart Mobile Studio itself and runs inside the IDE in an embedded Chromium browser. It uses Websockets to communicate with the IDE itself. As the Designer is an HTML4 application, it’s able to display accurately what all the components look like, instead of the dull old boxes in the old designer. You can set Align, Anchors, Angle, styles and any other properties and see exactly how they look like visually. You can also add a TW3TabControl and add and edit contents inside any tab.

The new Designer also supports non-visual components. Out of existing components in the RTL, TW3Timer, TW3HttpRequest and TW3WebSocket were added to the component palette in this release, but many more can also be added easily. This brings Smart Mobile Studio a lot closer to the way developers are used to work in Delphi.
The new Designer also has proper Undo-support and extensive copy-paste, even between multiple instances of SMS.

The RTL contains a new TW3PopupMenu-component along with a Menu Editor. The popup menu can be added to any component easily, by using any button as a Hamburger Menu or by using it as a traditional popup menu by right-clicking on a component. The designer itself uses the new TW3PopupMenu for any editing actions.

There is also a new TW3FormResizer-controller, which can be used to make any component resizable and draggable. It’s used in Designer’s Wizard forms.

The biggest changes in the RTL are related to constructing of forms when the application is starting. The code that the IDE generates for all the visual components makes sure that the components are ready before setting properties or creating child components. The RTL also properly waits until every single component is created, initialized and sized before calling InitializeForm. This eliminates tricky situations where a component was accessed, resized or hidden at the wrong time.

Some big changes were also made to TW3Application.ShowModal. In previous versions the OnInit(), OnOk() and OnCancel() -callbacks passed Dialog: TW3CustomForm as parameter. This was changed to passing ModalInfo: TModalInfo. You can access the modal form through ModalInfo.ModalForm to set and read parameters. Finally, call ModalInfo.Close in the OnOk- or OnClose-callback to properly close the modal form. There is also a new Application.ShowModalForm()-procedure, which lets you show any form as modal.

Installation

This Alpha-version can be downloaded with the SmartUpdate utility. Select the ALPHA -channel for this version.

Known issues and limitations

– The IDE may not always close properly leaving an extra SmartMS.exe or CEF4Delphi.exe process hanging. If this happens, they can be terminated through Task Manager.
– The designer currently only uses the default theme.
– Selecting multiple components for moving/editing is not yet implemented.
– TW3StringGrid does not yet have a Wizard.
– More advanced components like the Ace editor, TW3GoogleMaps and TW3LeafletMap do not show a WYSIWYG designer component. This is by design as they’d bloat the designer with huge amounts of external code.

Changes since 3.0.2

20.12.2019

IDE:
– New WYSIWYG Designer, which is a huge improvement over the original visual designer
– Made in Smart Mobile Studio itself.
– Visualizes every property including align, anchor, angle, styles
– Supports non-visual components like TW3Timer and TW3PopupMenu
– Allows advanced editing of controls, like TW3TabControl pages and contents
– Supports Wizards (TW3PopupMenu)
– Supports cut/copy/paste correctly using System clipboard
– Has extensive Undo-support
– Improved code generator for generating Form impl-code
– When an event is created, add missing dependency units for function parameters too
– Improved handling of Anchors
– Anchors can be set in the Object Inspector
– Added two new properties: AnchorGapRight and AnchorGapBottom.
These are set by the Designer to the distance of the bottom right corner
from the parent bottom right corner.
– Add new Welcome Page, which was made in Smart Mobile Studio itself.
– Update internal Chromium browser
– Update DWS to version 20190215.0

Most important RTL-changes:
– Improvements to constructing of forms when the application is starting.
– The code that the IDE generates for all the visual components makes sure
that the components are ready before setting properties and creating
child components.
– The RTL makes sure to wait until every component is created and initialized
before calling InitializeForm.
– These changes eliminate tricky situations where a component was accessed
or resized at the wrong time or a form was hidden while it was being built.
– Callbacks in ShowModal changed to pass ModalInfo as parameter instead of Form.
– You can still access the form through ModalInfo.ModalForm
– Close the modal form in OnOk() or OnCancel() by calling ModalInfo.Close
– New TW3Application.ShowModalForm
– Application.FormsArray will now only contain the forms that were automatically
created and registered during application startup.
– Change GetVisible to only check visibility-style from the component itself
– Add new IsVisible, which checks any other reasons for a component’s visibility,
like for example if the parent is visible.
– Change GetTop, GetLeft, GetHeight and GetWidth to read values from computed style,
which lets us read these values also when the component or form is hidden.

Additional RTL-changes:
– New TW3PopupMenu, which can be added to any component easily, by using a button
as a Hamburger Menu or by using it as a traditional popup menu by right-clicking
on a component. The new Designer has a Wizard for editing the menu items.
– Improvements to TW3ScrollBox
– AutoUpdate-property. If true, the scrollbox monitors changes in child components
and updates itself automatically.
– ForceParent-property. If true, child components are automatically moved
to the Content- component.
– Child components can be added to the ScrollBox in the new Designer.
– TW3TabControl: Tabs and Tab contents can be edited in the new Designer.
– New versions of TW3CheckBox and TW3RadioButton. Uses only CSS for resizing.
– Bug fixes to TW3ToggleSwitch
– Improvements to EventManager:
– Make OnAllMovement compatible with SetCapture
– Prevent extra OnClick when using SetCapture
– Make sure that more advanced components stop painting contents when the component
is not visible (for example: TW3ListBox, TW3TabControl, TW3ScrollBox)
– New TW3URL, which contains URL parameter handling like Delphi’s ParamStr, ParamCount etc.
– New controller: TW3FormResizer, which can be used to make a form (or any other control)
resizable and draggable.
– Move initialization of Label alignment styles to SmartCL.Css.Stylesheet,
so they can be used in other units as well
– Add TPoint.MoveBy
– Add DateTimeToLocal and LocalDateTimeToUTC to DateUtils
– Parent can now be changed, so components can be moved to different parents just like in Delphi
– Add support for Background position
– Change w3_getPropertyAsInt to return 0 if value is NaN
– Animations and some other browser specific CSS did not work properly in Firefox
due to wrong Browser-prefix.
– Bug fix to setting the cursor by name.
– Fix numerous bugs in TW3EdgeSenseController.
– Bug fixes to BringToFront and SendToBack

18.7.2019

IDE:
– Zip Entire Project did not include Form .sfm -files

RTL:
– Bug fixes to TW3TabControl

6.7.2019

IDE:
– Anchors (and other sets) can be set in the Object Inspector
– Improvements to generated Form implementation code:
– Wait until created components are ready before setting properties and creating children
– Set Anchors last
– Prevent conflicting keyboard shortcuts from being saved
– Use better default project options (no manifests, do not embed Javascript)
– Add new units to units defaults and improve formatting

RTL:
– Add xml-js to Libraries.
– New ECMA.Promise unit from api docs
– System.JSON:
– Support for adding/setting JSON arrays
– Add TJSONObject.Delete
– Set form size to 100% before calling InitializeObject
– Add missing units to SmartCL.Controls
– Setting control’s angle did not work in Firefox
– Don’t raise an exception while freeing a form which is not registered
– Themes: default styles were not applied for all elements in Android and iOS
– Fixes a bug where textarea’s size is too big in TW3Memo

24.4.2019

RTL:
– Anchors and Align-support to the RTL.
– Support in the IDE is currently being worked on. Currently Anchors can
only be set in code. Align can be set in the Object Inspector, but the
changes are not reflected in the designer.
– Bug fix to BoundsRect
– Themes: New background for highlighting errors: bsErrorBackground
– TW3StringGrid:
– New event for setting custom row borders and backgrounds: OnDrawGridLineTheme

14.4.2019

RTL:
– Improvements to TW3StringGrid:
– New columns types:
– TW3StringGridNumericColumn
– TW3StringGridButtonColumn
– Added sorting
– New event: OnCellChanged
– TStringList and TObjectList: Add Sort() with CompareFunction.
– Fix CSS browser prefix for Firefox
– Themes: Use normal size and style text in buttons.

27.3.2019

RTL:
– New control: TW3StringGrid
– New featured demo for the StringGrid.
– New TW3CustomScrollControl, for developing scroll controls with scrollbars/indicators-support.
– New border types: btLightBorderTop, -Bottom, -Left, -Right, -Horiz and -Vert
– EventManager: Check TouchPreventDefault before trying to prevent extra artificial mouse events from touch events
– Improvements to TW3BlockBox and Modal dialogs:
– TW3BlockBox did not trigger a resize
– Dialogs did not get resized when window was resized or device flipped
– Make sure the dialogs are not too big

21.2.2019

Bug fixes and improvements to the IDE:
– BringToFront and SendToBack will now affect component creation order.
– Opening files from Project Search Path is fixed.

20.1.2019

RTL:
– New controls: TW3SpinButton, TW3ArrowUpButton, TW3ArrowDownButton, TW3ArrowLeftButton and TW3ArrowRightButton.
– Add 1px margin to TW3ButtonBorder to prevent the border from being clipped.
– Bug fixes to Tween.Effects

IDE:
– Bug fixes and changes to renaming of forms:
– Renaming in Project Manager will not change form class any more.
– Form class name can be renamed in Object Inspector.
– Improvements to Project Statistics:
– Only count Total time when Smart Mobile Studio IDE has focus.
– Only Count Design time when changes are made in Form Designer.
– Add clear button.
– Component Palette:
– Added new controls
– New icons for many existing controls

Smart Mobile Studio 3.0.2 is released

Posted on 21.12.2018 by Jarto Tarpio Posted in News

Smart Mobile Studio 3.0.2 is released

This release contains lots of fixes and improvements to the IDE as well as improvements to the RTL.

Installers

  • Smart Mobile Studio installer
  • Free command-line compiler

Portable installation

Smart Mobile Studio can also be downloaded with the SmartUpdate utility. Select the MASTER -channel for the official version.

Changes since 3.0.1

20.12.2018

RTL:
– TW3TabControl:
– AnimateTabs-property to control how tabs are changed.
– TW3ListBox:
– Prevent an exception if TW3Image is used as a line control and OnShowItem is not set.
– TW3ListMenu, TW3HeaderControl and TW3SimpleLabel:
– Don’t set default caption to classname during initialization.
– DWScript: Capitalize day and month names correctly (January instead of january, Sunday instead of sunday)

IDE:
– Improvements to the way the IDE reacts to a changed external file.
– Use caption while drawing generic controls instead of component name.

12.12.2018

RTL:
– TW3ListMenu:
– Add Items-property, so items can created in Object Inspector.
– Add OnSelected-event.

IDE:
– Bug fix to renaming of units
– Show form source instead of designer when form is selected from Project Manager

6.12.2018

– SmartNJ.Server.Http: Do not free Request and Response after OnRequest has been generated.
– Updated nodejs http- and https-demos with an example on how to read POST content.

5.12.2018

– Fixed “Argument out of Range” -error while renaming forms or units.
– Fix bug in renaming Form1, which did not change TForm1-classes in Form1.
– This happens if Form1 is not listed in the uses-clause of the main project source.
– Fixed in new projects.
– In older projects, users should change the uses-clause to also contain Form1
– Update uses-clauses in Form1 of a new project to get the same units as a new form.

26.11.2018

RTL:
– Bug fix to SmartCL.Layout: Set component size before position, to avoid problems in bottom and right alignments.
– Bug fix to TW3ToolControlFlatBorder in iOS theme.
– TW3BufferedImage: Don’t try to use TW3BackgroundGraphicContext, which was deprecated in Chrome

22.11.2018

RTL:
– Add styles for TW3RadioButtonLabel and TW3CheckBoxLabel. Also remove hard coded color from source code.
– Add default property values for in various components for the Object Inspector.

IDE:
– Property Inspector shows default values from RTL source.

17.11.2018

RTL:
– Changes to handling of Cursor:
– Style definitions moved from basic html elements to control styles
– GetCursor and SetCursor can now be overridden
– Bug fixes to how many controls handle cursor. Especially TW3Label.
– Themes:
– Add missing styles TW3CheckBox, TW3CheckMark, TW3RadioButton, TW3RadioToggle and TW3RadioGroup
– Two new backgrounds: TW3DecorativeListItemBackground and TW3TransparentBackground
– RTL optimizations to creation of controls, GetBoundsRect, SetBounds, MoveTo and SetSize.
– Bug fix to SmartCL.Graphics.pas: Changing of canvas font, size and styles did not work.
– Bug fix to System.DateUtils.DecodeDate.

IDE:
– Delete key works now Search dialog and other dialogs.
– Bug fix: Internal Browser Window showed only a white screen if Execute was clicked while it was open.

Compiler:
– Now(), EncodeDate() and EncodeTime() returns now the same values as Delphi and FPC
– All time/date -functions fixed to work with the new TDateTime-values

Development updates

Posted on 25.11.2018 by Jarto Tarpio Posted in Developers log, News

Developing Smart Mobile Studio was a lot of fun last week. We solved two pet peeves in the IDE and improved the Object Inspector. Ever wondered why we couldn’t use the Delete-button in the Search dialog? Or why the Internal Debugger always had to be closed before clicking Execute again? Well, no need to wonder any more – they are fixed now.

In the RTL my all time most frustrating bug in Smart Mobile Studio was also fixed: The way TDateTime worked. As most of you know, TDateTime is a float where the integer part represents the day and fractions the time of the day. So, when you do a EncodeDate(2018,12,1) in Delphi, you get a simple integer: 43435. However, in Smart Mobile Studio, you got a value anywhere between 43434.5 to 43435.5. When you built a time with EncodeTime(8,0,0,0) and wrote it out with TimeToStr(), you didn’t get 8:00:00. Where I live, I got 12:00:00. That’s because the underlying javascript date functions, that the compiler used, built the date in UTC but viewed the time from the time zone where you ran the program. If you Google for date handling in javascript, you’ll find countless pages where js programmers are struggling with these as well.

When I joined the development team more than a year ago, I wanted this fixed yesterday, but it wasn’t simple. I was told that we’d need to upgrade to a newer version of DWScript, which was not an easy task. However, it turned out that the upgrade was not necessary. So last week I went through all the date and time handling functions in DWScript and fixed this for good.

To get all the latest fixes and updates, do follow this forum post. We opened up the DEVELOPMENT-channel in SmartUpdate, so all our users can get fresh updates right away.

Smart Mobile Studio 3.0.1 released

Posted on 08.11.2018 by Jarto Tarpio Posted in News

Smart Mobile Studio 3.0.1 is released

This is the first release since 3.0. Biggest new feature is TW3LeafletMap, which lets you use OpenStreetMap. As it does not need API keys (like TW3GoogleMaps), it’s really fast and easy to use:

– Create a project
– Add a TW3LeafletMap -control on the form
– Set AutoCreateMap to true on the map control

Please see the changelog at the end of this post.

Installers

  • Smart Mobile Studio installer
  • Free command-line compiler

Portable installation

Smart Mobile Studio can also be downloaded with the SmartUpdate utility. Select the MASTER -channel for the official version.

Changes since 3.0

8.11.2018

RTL:
– EventManager:
– Add procedure AllowDefaultAction, that can be called from OnClick when the default
action should happen. For example: To let the virtual keyboard to pop up from OnTouch.
– Bug fixes:
– Native scrolling was prevented if scrolling was done from an unknown element.
– Prevent an extra OnClick from being fired on mobile devices.
– TW3ListView: Bug fix to resizing of items.
– Bug fixes to GeoLocation. Also update the Geolocation demo.
– Deprecate PhoneGapAPI’s JGeolocation functions. SmartCL.GeoLocation.pas should be used instead.
– Fix slider so that OnMouseDown, OnMouseUp and OnMOuseMove can be used.
– TW3TabControl Tab’s OnShow was sent twice for the first tab
– SmartCL.RegEx moved to System.RegEx. Also fixed TW3RegEx.Exec to return a proper empty array instead of nil.
– Bug fix to Chart: TSeriesData.Refresh now also updates the X axis
– TW3Grid:
– Added TW3ImageColumn
– Add Alignment-property to TW3ColumnHeader
– Added a new OnCellControlCreated-event, which fires when a button, toggle, progress bar or image is created.
Makes it possible to change properties of the control easily.
– Added support for OpenStreetMap using the Leaflet library:
– New control: TW3LeafletMap
– New featured demo: LeafletMap

IDE/Compiler:
– Fixed search path compilation issues
– Relative and absolute paths are working now
– Compiler is updated when search path is modified in options
– $I will look for include file in the project folder first
– $R supports absolute paths, wildcards, folder name extension and ($Libraries) macro
– Fix exceptions in Search
– Upgrade to UPX 3.95

23.7.2018

– SmartCL.Effects: Properly handle padding and margins while doing effects.

22.7.2018

– Fix to css-files for selected text in TW3Edit and TW3Memo

Smart Mobile Studio 3.0 is released!

Posted on 20.07.2018 by Jarto Tarpio Posted in News

We are proud to release Smart Mobile Studio 3.0!

So, what’s new? Oh boy. Where do I even start? There’s tons of changes. The RTL has gone through a big rewrite, which has made it a lot faster. Also, all JavaScript- related quirks have been taken care of. Events work as you expect as a Delphi programmer. All weird resize- bugs are gone. There’s a new way of doing styling, where you can choose backgrounds and borders from a set of pre-defined styles. This makes it easy to have a consistent look in all your controls instead of having to write separate CSS definitions for every control.

A huge amount of attention was to make everything work fast and smooth on mobile devices. There’s a very nice TabControl that lets you change tabs by swiping. And a new ListBox, that is blindingly fast with huge amounts of lines. There are scrollboxes with momentum scrolling. And PhoneGap works as it should adding very easy-to-use push notification support.

Compatibility is great across browsers and mobile devices. While older versions were close to unusable on a Windows phone, Smart Mobile Studio 3 makes even an old Lumia phone fly.

On top of all that, we have made programming easy and fun with margins and padding. The RTL automatically resizes and moves your controls respecting the margins and paddings that the style sheet has. You can also use relative positioning and FlexBox.

We have many new visual controls: TW3ScrollControl, TW3ScrollBox, TW3NativeScrollBox, TW3ListBox, TW3CheckListBox, TW3TabControl, TW3GroupBox, TW3RadioGroup, TW3MediaPlayer and a very cool TW3GoogleMaps. We also added the Ace Editor!

In the IDE we’ve not only fixed bugs, but added better support for properties in the Object Inspector. While previously you had to add ComboBox -items in code, you can simply set the items with the Object Inspector, just like in Delphi.

Under the hood, in the RTL there are also a lot of changes. System.Collections, storage devices that unify file handling across platforms, streams, datasets, you name it.

A lot of work has been done on Smart Mobile Studio’s NodeJS features, which lets you produce scalable applications for cloud platforms or even cheap mini computers like the Tinkerboard or Odroid XU4. You can write HTTPS-servers and use Secure Web Socket.

As an example of what Smart Mobile Studio 3 can do, we’ve written a Smart Desktop -demo to show what is possible. Go to desktop.smartmobilestudio.com and hit the Login-button. The Desktop communicates with a Linux-server running a NodeJS-server application, which is also written in Smart Mobile Studio. The source code of both demos is included in Smart Mobile Studio 3.

Installers

  • Smart Mobile Studio installer
  • Free command-line compiler

Portable installation

Smart Mobile Studio can also be downloaded with the SmartUpdate utility. Select the MASTER -channel for the official version.

Smart Mobile Studio 3.0.0 beta2 released

Posted on 08.06.2018 by Jarto Tarpio Posted in News

Smart Mobile Studio 3.0.0 beta2 is released!

Installers

  • Smart Mobile Studio installer
  • Free command-line compiler

Portable installation

Smart Mobile Studio can also be downloaded with the SmartUpdate utility. To get the beta, make sure to select the BETA channel. If you already have the Alpha-version installed, you can upgrade it to the Beta -version by running the SmartUpdate.exe with the /changechannel switch.

Changelog since beta1

8.6.2018

RTL:
– Prevent whole page from being dragged down/up in iOS.
– TW3TabControl: New property AllowSwipe, to control if tabs can be changed by swiping sideways.
– Bug fix to TW3CustomControl.SetNativeScrolling.

7.6.2018

NodeJS:
– New Ragnarok message framework.
– Lots of changes and improvements to the websocket server.
– Use the latest node.js engine and get rid of the websocket.io framework.
– SQLite3 import api: Nodejs.SQLite3.pas
– Lots of imporvements to TApplication object.
– Lots of improvements and bug fixes to the WebSocket server
– TW3DirectoryWatch moved to SmartNJ.Device.Storage.Watch.pas
– New logfile using write-stream in append mode: SmartNJ.LogFile.pas

RTL:
– New base-classes for a unified DB Framework: System.DB.pas
– All Base64 and UTF8 encoding implemented in Smart Pascal code instead of external js.
– Added OnChildAdded/Removed events to TW3TagContainer.
– New TIniFile-class: System.IniFile.pas
– TW3TagObj.FreeAfter, which can be used to free components after a delay.
– Src property published in TW3IFrame
– TW3ScrollControl to lock scrolling direction to the detected direction.
– Can be controlled with ScrollController.LockMovementDirection -property.
– Improvements and bug fixes to TW3ListBox
– Added InvalidateVisible for a quick and full repaint.
– Added horizontal scrolling if ItemWidth is wider than the listbox.
– Improvements and bug fixes to TW3EditBox and TW3Memo
– Fix text selection bug in Firefox.
– Add MaxLength-property.
– New function TString.EncodeTags, which converts tags and dangerous characters to safe html symbols.
– EventManager: Prevent extra mouse events if OnClick was generated from touch events.
– TabControl:
– Prevent from calling InitializeForm twize, if the tab was a form.
– Improve tab header resizing.
– ListBox:
– Change TagValue to Variant.
– Fixed mouse handling bugs in the ACE editor.
– Bug fixes to font measurement.

Compiler:
– Implemented ‘static’ linking of Javascript files: {$I ‘file.js’}

18.3.2018

RTL:
– Moved WriteLn and WriteLnF from SmartCL.System to System.Types, so they can be used
in WebWorker -projects.
Demos:
– New WebWorker -demo, which counts Primes, demonstrating how you can use all CPU cores.

17.3.2018

RTL:
– Moved coversion and encoding related functions from System.Types to System.Types.Convert,
which results in a lot smaller js-size in WebWorker projects.

16.3.2018

Bug fix to WebWorkers.

14.3.2018

Bug fix to the IDE and TW3GoogleMaps to make the CenterLat- and CenterLng-coordinates work.

13.3.2018

IDE:
– Added TStrings-support to Object Inspector, which allows editing of:
– TW3ListBox.Items
– TW3ComboBox.Items
– TW3RadioGroup.Items
– TW3TabControl.Tabs
– NodeJS background executions are stopped when project is closed.
– Bug fixes to OmniXML
– Updated Datasnap proxy generator dll to latest
– Fixed problem with Datasnap access interface importer

RTL:
– New control: TW3GoogleMaps
– TW3TabControl can use Forms as Tab contents (Check TabForms -demo)
– Updated node.js headers to version 8.10.0 LTS compatible with stable v9.8.0)
– Isolated node.js EventEmitter in separate unit (NodeJS.Events) as per specification (node.js v6.9.1)
– Implemented System.IOUtils with storage independent TPath class
– Implemented a synchronous node.js filesystem API, TW3NodeSyncFileAPI class in SmartNJ.System
– Implemented abstract directory parser (TW3DirectoryParser in System.IOUtils)
– Implemented standard system file and folder functiction in SmartNJ.System
– Upgraded our virtual, BTree based in-memory filesystem to use TPath
– Changed TW3VirtualFileSystem to store data as TByteArray rather than variant
– Implemented directory parser for Linux, Unix and Windows
– Implemented abstract storage device driver (System.Device.Storage)
– Implemented storage device driver for browsers (SmartCL.Device.Storage)
– Implemented storage device driver for node.js (SmartNJ.Device.Storage)
– Implemented TW3DirectoryWatch class for node.js (SmartNJ.Device.Storage)
– Implemented TApplication object for node.js, exposing traditional properties and process info
– Updated our message api (SmartCL.Messages) to support javascript messagechannel ports
– Added full support for socket.io clients (SmartCL.Net.Socketio)
– Updated TW3Memo control to initialize states for autocorrect, autocapitalize etc.
– Added GetIsRunningInBrowser function to system.types
– TStreamReader and TStreamWriter moved to System.Reader and System.Writer units.
This deprecates the System.StreamReader and System.StreamWriter units.
– Implemented new string parser functions for recognizing intrinsic types (TDataType in System.Types.Convert)
– Updated TW3DatasetFilter to use new parser framework
– Fixed string-to-intrinsic-type (TryStrToInt, TryStrToBoolean etc) functions
– Full re-implementation of our parser framework (System.Text.Parser)
– Partial class TBinaryData, under node has functions for consuming and emitting data as a node buffer
– Fixed bug in our node.js http server (SmartNJ.Server.HTTP) where the response object would not release if an
error occured, causing the server to drop the connection.
– Cleaned up multiple declarations for JBuffer and JNodeBuffer, now isolated in unit nodejs.core
– Changed default creation flags for node.js files to R+W as opposed to R+W+E (only affects Linux)
– Fixed bug where TNJHttpRequest.GetHeaders function returned null
– Removed use of JError under node where applicable, now use TJSErrorObject from system.types unit
– Updated bytecode assembler and virtual machine project to latest
– Removed TFileNameHelper class from SmartCl.Legacy unit, this is now handled by TPath in System.IOUtils
– Updated codec manager (system.codec unit)
– Implemented RC4 encryption codec and binding (System.Codec.RC4)
– Updated Base64.js to latest revision (libraries/base64.js) which is added by the linker on demand
– Full re-implementation of base64 codec (System.Codec.base64 unit)
– Changed TString.ToBase64() function to use new codec
– TW3GroupBox header fixed, now uses TW3Label rather than mapping the unreliable “legend” tag
– Improved AutoCreateForm routine, this now performs better checking before construction
– TW3Grid control now uses TW3ScrollControl as a container, adding momentum scrolling and better touch handling
– Fixed important problem with TString helper class, function missing @ for result caused exception

Demos:
– Full reimplementation of our websocket server, replacing websocket.io with the standard ws package
– Updated all node.js demos to use our high-level classes
– Updated WebSQL demo to use correct names
– Updated “Binary data” demo to use TBinaryData class (System.Memory.Buffer unit)
– Fishfacts demo updated to use new functionality
– Fixed problems with advanced demos (biotopia in particular) to work with latest RTL

Smart Mobile Studio 3.0.0 beta1 released

Posted on 12.02.2018 by Jarto Tarpio Posted in Announcements, News

Smart Mobile Studio 3.0.0 beta1 is released!

After almost 5 months of development of Smart Mobile Studio’s alpha-version, we are proud to release the first beta-version of the upcoming version 3.0.0.

Major changes:

  • A control’s style is now split up into a border style, background style and control’s own style. Details
  • Size and position of controls are automatically adjusted according to margins and padding. Description and discussion
  • Improved support for PhoneGap Example
  • Support for WebFonts and Font-Awesome

Installers

  • Smart Mobile Studio installer
  • Free command-line compiler

Portable installation

Smart Mobile Studio can also be downloaded with the SmartUpdate utility. To get the beta, make sure to select the BETA channel. If you already have the Alpha-version installed, you can upgrade it to the Beta -version by running the SmartUpdate.exe with the /changechannel switch.

Known problems:

  • A few demos are not yet updated:
    • Biotopia in Contest Demos
    • ControlsListMenu and ControlsToolBar in Smart Book Demos
  • Datasnap importer is not working at the moment

Changelog since release of the first alpha:

12.2.2018

First Beta of the upcoming Smart Mobile Studio 3.0 -version.

3.2.2018

– Bug fix to LoadFromStream in Sqlite
– Bug fixes to TMemoryStream and TStringStream

25.1.2018

– Bug fix to streams.

21.1.2018

– Bug fix to transitions.
– Various bug fixes to demos.

9.1.2018

– Bug fixes and improvements to TW3ListBox and TW3CheckListBox.
– Bug fix to Control Animation-demo.

8.1.2018

IDE:
– Added support for search paths
– Updated SynEdit
– Bug fixes
– ACE (TW3AceEditor) added to the Component Palette

RTL:
– New units:
– System.Collections
– System.StorageDevice
– Marjor improvements to TW3Dataset, TW3DatasetFilter and WebSQL
– Bug fixes and improvements to TextParser
– Bug fixes to WebFonts support
– Moved TCriticalSection to System.Types
– Improvements to TW3ListBox and TW3CheckListBox:
– Support for SelectedIndex and automatic change of style
background for selected items
– Support for MultiSelect
– Possibility to override creation of TW3ListBoxItemData
– Allows use of own classes and properties
– Allows overriding SetSelected to control what styling
changes should be made when items are selected

Bug fixes to many demos

9.12.2017

– Phonegap: Added Push Notification Support.

29.11.2017

– Important bug fixes to PhoneGap support.
– Fixup of legacy and color mixing classes.

22.11.2017

– Fix scrollbar bug in embedded Chrome browser.
– TW3EditBox and TW3Memo
– Added AutoComplete, SpellCheck, AutoCapitalize and AutoCorrect
– Allow scrolling of memo contents
– Fix bugs related to setfocus
– Update RequireJS to v2.0
– Changes to how EventManager passes or prevents touch events.
– Optimizations and bug fixes to
– System.Dataset
– System.Text.Parser
– TStringHelper
– Small fix to the Label caption to let designer set empty caption.

17.11.2017

IDE:
– Major improvements to Object Inspector (enum-types)
– Added more default units to uses-clauses

RTL:
– TW3Button rewritten.
– Bug fix to TW3BitBtn.
– Bug fixes to System.FileSystem.Memory.
– Big fix to Dialogs.

11.11.2017

Bug fix to scrolling in older iOS devices
Fix to Keypress in Android

9.11.2017

New demo: Featured Demos / Dialog Demo
Fixed Spartacus Demo to use new Dialogs

8.11.2017

This update contains a lot of big changes:
– Themes have been completely rewritten and updated.
– Most controls have been rewritten.
– Massive speed improvements.
– Support for native scrolling even on mobile devices.
– Support for FlexBox.
– Support for font-awesome and webfonts.
– Vastly improved dialogs.
– Automatic support for margins and padding.
– IDE: Bug fixes and small improvements.

16.10.2017

Fixes and improvements to the debugger

8.10.2017

Fix to HttpAndJsonp-demo

7.10.2017

Improvements to resizing:
– Fix wrong display height on iOS/Chrome after device flip
– Reduce number of resizes during startup

5.10.2017

New controls:
– TW3RadioGroup
– TW3MediaPlayer
Support for WebFonts
Styling changes to TW3ScrollControl’s background
EventManager to send OnClick through CBClick
Bug fixes to the RTL
Bug fixes to the IDE

28.9.2017

Improvements to Resizing:
– Minimize number of resizes during form create.
– Trigger only one resize during device flip.

26.9.2017

– New controls and classes:
– TW3GroupBox
– TW3RadioButton
– TStringStream
– Improvements to Game View initialization
– Added overloaded ShowDialog with custom width and height
– Fixed Contest Demos:
– RetroBalls
– PolyDna
– Afternoon Walk
– GraphicsDemo

20.9.2017

Bug fixes and improvements to
– TW3Button
– TW3ScrollBox
– TW3ScrollContentIndicator

19.9.2017

Bug fixes to TW3GraphicControl/TW3PaintBox.
Fixed the Minesweeper-, Tetris- and Box2D-demos.

18.9.2017

Improvements to TW3HeaderControl initialization.
Bug fix to TW3Button to prevent multiple clicks.

16.9.2017

Bug fix: Fixed form saving immediately after project creation

Smart 2.9.9 [alpha] is here!

Posted on 14.09.2017 by Jostein Posted in News

We are proud to release Smart Mobile Studio 2.9.9!

This is an Alpha Version of the upcoming version 3.0.0. We’ve been making so much changes and new features, that listing them all is next to impossible.

A lot of work has been done to make this the fastest and most stable version of Smart Mobile Studio with great support for all major browsers and mobile devices.

How to download this alpha?

Simple. Click here to download the ZIP containing portable version 2.9.9.34. Unpack it into any folder.

If you have a valid Smart Mobile Studio license, copy file user.lic to that folder, too.

Start SmartMS.exe. If you don’t have a license, you can click the button “Request trial license” to get a free 35-day trial key.

You can also periodically run program SmartUpdate.exe to check if Alpha was updated.

What’s new?

Following list reflects just the most important changes:

  • New TW3ScrollControl, TW3ScrollBox
  • Supports MomentumScroll
  • Supports touch
  • Supports both scroll bars and indicators
  • New TW3ListBox
    • Supports desktop and mobile devices
    • Very fast
    • Can have huge number of lines
    • Dynamic item draw
      • Only draws visible lines
      • Can be customized with OnShowItem to produce TVirtualListBox-kind of features
    • New events for “refresh by pulling list down”:
      • OnPullStart
      • OnPullMove
      • OnPullEnd
    • Old one renamed: TW3ListView
  • New TW3Label
    • Very fast
    • Supports Word wrap, autosize and both horizontal and vertical alignments
  • New control: TW3CheckListBox
  • New control: TW3TabControl
    • Smooth scrolling and tab changes
  • New control: TW3BitBtn
  • EventManager
    • Fixes a lot of problems when dealing with mouse and touch events
      • Events firing at multiple controls
      • Mouse getting stuck while releasing mouse button outside of the browser window
    • Listens to both mouse and touch events
    • Can convert touch events to mouse events, so one only has to listen to OnMouseDown, OnMouseMove and OnMouseUp
    • New events for scrollable controls:
      • TW3CustomControl.OnBeginMovement
      • TW3CustomControl.OnEndMovement
      • TW3CustomControl.OnVerticalMovement
      • TW3CustomControl.OnHorizontalMovement
      • TW3CustomControl.OnAllMovement
    • New properties for TW3CustomControl:
      • SimulateMouseEvents: SMS generates OnMouseDown, OnMouseUp and OnMouseMove events also from touch events.
      • TransparentEvents: If true, events are passed to the parent control.
  • IDE: Bug fixes and improvements

A lot more listed here:
https://jonlennartaasenden.wordpress.com/2017/02/06/smart-pascal-changes/

Known bugs/issues

  • Project options/Linker/Add Source map results in an exception during compile.
  • There are graphical glitches in the internal browser. For example: Combobox list.
    While these may look weird, they do only show up in the internal browser and do not affect how your app behaves in a browser.
  • TW3TabHeaders does not have styling for all platforms.
  • Compile and Execute while the Internal Browser window is visible results in a white window.
    Just close and hit Execute again.
  • Styles are still not completely finished. Default style works best while other styles may have issues.

Guide for porting your old projects

If the compiler can’t find:

  • TPoint, TRect or other graphics related types, add System.Types.Graphics to the uses clause.
  • TW3EventRepeater, change SmartCL.Time to System.Time in the uses clause.
  • TW3Component, add System.Widget to the uses clause.
  • Memory buffers, change SmartCL.Buffers to System.Memory.Views in the uses clause.
  • Local storage, add SmartCL.Storage.Local to the uses clause.

Code changes

  • Old: Canvas.Font := ’14px sans-serif’;
    New: Canvas.FontStyle := ’14px sans-serif’;
  • Old: Http.SetRequestHeader(‘Content-Type’, ‘application/x-www-form-urlencoded’);
    New: Http.RequestHeaders[‘Content-Type’] := ‘application/x-www-form-urlencoded’;
  • Old: EncodeURIComponent()
    New: TString.EncodeURIComponent()
  • Old: VariantToObj()
    New: TVariant.ToObject()
  • Old: w3_Callback()
    New: TW3Dispatch.Execute()
  • Old: w3_SetInterval()
    New: TW3Dispatch.SetInterval()
  • Old: w3_ClearInterval()
    New: TW3Dispatch.ClearInterval()
  • Old: w3_SetTimeout()
    New: TW3Dispatch.SetTimeOut()
  • Old: w3_ClearTimeout()
    New: TW3Dispatch.ClearTimeOut()

If you are using the old TW3ListBox and features that are not available in the new TW3ListBox, change all TW3ListBox -> TW3ListView.

If you are listening on mouse and touch events through Control Handle or addEventListener,

  • Use standard TW3CustomControl.OnClick, OnMouseMove, OnMouseDown, OnMouseUp etc.
  • If you want to also support touch events, set TW3CustomControl.SimulateMouseEvents:=True;

If you call Resize in your own code, change the call to Invalidate. Invalidate calls resize with a short delay. And if there are multiple calls to Invalidate before the timer has triggered a resize, the extra calls will be ignored resulting in a lot faster app.

SPNG: Be informed when values change

Posted on 08.04.2017 by Jon Lennart Posted in Developers log, News, News and articles 2 Comments

There are many new and powerful features in the upcoming release of Smart Mobile Studio (also refered to as Smart Pascal, Next Generation: SPNG in short): One of the most powerful is the ability to be notified when a value or object changes with a single line of code.

So far TVariant has just been a helper class for dealing with typical tasks. Well, perhaps not just typical because under Smart Pascal, variants can map directly to a javascript object (of any type) and allows you direct access to its prototype. The Handle property that all visual controls have is an example of this. The type TControlHandle is actually a reference to the visual element inside the DOM (document object mode). So by accessing that directly in your code, you can change styles, attributes and properties of that element. You are not bounds to only use our pre-fabricated solutions.

In the next update TVariant have a lot of new members. Two that stands out as important: watch() and unwatch().

As their name imply they will warch something for you. In this case you wil be notified whenever a single property, a whole object or indeed – a property deep within an object is altered. It may sound trivial but it’s actually one of those features that lays the foundation for responsive, data-aware controls.

But you can use it for many other things as well. For example you can now attach an event directly to a string. And whenever that string changes (either by your code, the user, or some other script) you can act on it directly. That is pretty cool and very helpful!

  // create an empty javascript object
  var MyValue: Variant := TVariant.CreateObject();

  // Set a default value
  MyValue.NewProperty := 12; // add a property and set a value

  // We want to know when the object changes
  TVariant.Watch(MyValue, "NewProperty", procedure ()
    begin
      showmessage("You changed the value!");
    end);

In this snippet we setup a javascript object and place a named-property inside that object. We then listen for changes to that property (by name even). So if you change that value further down in the code, or by calling some procedure elsewhere – the event will fire and show the message dialog.

This is of-cource just a tiny fragment of the new code that has been added, not to mention the changes and fixes. Some of these features are presently in alpha stage and is being tested. We will post more and more news in the days and weeks ahead – and we are sure you will be pleased with some the fantastic new things you can now code!

Here is an example of the new desktop and windowing applications you can write (picture below): The smart desktop!

The Smart desktop

We decided to update the uartex Media Desktop, an example initially made for touch based embedded environments – and turned it into a fully functional desktop environment!

Both the desktop itself, the filesystem, the IO drivers and windowing toolkit is written in Smart Pascal. You can create kiosk software designed to run on embedded devices, advanced applications designed to run on your intranet – or full cloud systems. So it can run a Smart application inside each Window if you like. But you have full control over windows, file access, directly listings, menu items and can sculpt both the desktop and applications to suit your needs.

The desktop can be coupled with a node.js backend that handles multi-user login and file access. It gives your users access to designated home-folders (again under your control). So each user can have their own work files just like a thin client, and each user can run different applications from a fully working desktop environment.

Below you are seeing Quake II compiled from C/C++ to LLVM bitcode. This is in turn compiled to JavaScript via asm.js. This means the browser will compile the javascript into machine code after loading. So Quake II runs at native speed, all JavaScript, inside our desktop window.

Create windowed applications with Smart Desktop

Create windowed applications with Smart Desktop

You will also be happy to head that x86 Linux and ARM kiosk distros have been created. So once happy with your desktop you can in fact boot straight into it in fullscreen. No Linux desktop or shell — just your desktop running. Both Firefox and Chrome can be used as presenter.

Have a great easter!

announcement code demo HTML5 javascript Object Pascal OP4JS release Smart Mobile Studio Upcoming features

JavaScript hardware, books and the long awaited update

Posted on 03.11.2016 by Jon Lennart Posted in News 1 Comment
Worth every penny!

Worth every penny!

If you head over to Manning publishing you will find a very interesting book called Javascript on things, written by Lyza Danger Gardner. As mentioned both here as well as Jon’s developer personal developer blog (*) on numerous occasions – more and more hardware is capable of running JavaScript. Or to be more precise: they use JavaScript as their primary automation language.

There is actually a whole market where you as a Smart Pascal developer can use your skills to deliver top of the line products. A market where archetypical languages like C++ and Delphi makes less sense. IOT is about adapting to technology quickly, pivoting on a dime, connecting hardware together in new and exciting ways. In such a market script engines makes more sense than heavy-duty native languages.

If this inspires you then have a look at JavaScript of things, it is one of those books you can return to again and again.

Smart Pascal and IOT

While we love JavaScript at The Smart Company we created Smart Pascal for a reason, and that was to give you the best of both worlds. Smart Pascal gives you a huge advantage over vanilla JavaScript.

The ability to write proper classes with traditional inheritance just like you do in C++ or Delphi is one of them. While JavaScript developers will argue that JS is object-oriented, it is not really true; at least not in the traditional sense. A JavaScript object has no VMT (virtual method table) and instead relies on something called prototypes. Which essentially is an object that can be expanded with new properties at any time, and properties can be both values and methods.

Inheritance is typically emulated through cloning of these prototypes. This is extremely inefficient and cause compatibility problems between frameworks and libraries. This is why standards such as require.js has become so important for JavaScript development because it provides structure. The same structure and order languages like object pascal and C++ gives you out of the box.

Smart Pascal doesn’t need things like require.js or similar standards to deliver order and safe code. Nor do we need to clone prototypes en-mass to fake what is already an intrinsic part of the language. Our compiler organize and sculpts a VMT in JavaScript itself and does exactly what C++ and Delphi does. Namely to isolate an objects data (the fields of your class) in a Self record. A self record that is passed along to class calls as the first parameter automatically. This completely removes the need for low-level cloning of entire objects. Class code is implemented once, and only the self record is initialized when you create new instances. So if you create 10 instances of a class you don’t get 10 copies of all your methods, all your properties and so on in memory. Instead you get 10 instance records (self) and your code is compiled once. This is the way of things, the way of the force .. 😉

So believe it or not, but traditional object orientation in itself an advantage over traditional JavaScript. Then you get all the other perks of a real, archetypical programming language on top of that: interfaces, partial classes, virtual and abstract methods, helper classes, operator overloading, unit organization, a wast runtime library of classes and visual controls – and much, much more!

Most Delphi or C++ developers don’t really think about these things. We are so used to proper inheritance and VMT operations that we regard them as fundamental. Which is also why many C++ and Delphi developers dont like to work in JavaScript. They get the sense that JavaScript is sort of half-finished. Which is actually true! The author of JavaScript never got to finish it, so the prototype system in JavaScript was never intended to be publicly exposed. He was aiming for object inheritance like Smart Pascal and TypeScript delivers – but sadly he never got to finish that part.

Using Smart Pascal to work with JavaScript enabled hardware

Smart Mobile Studio has supported this for quite some time. You can create Espruino projects if you need to work with micro controllers. If you look in the RTL directory there is a folder named Espruino, and it contains pascal versions of the Espruino JavaScript objects. It really gives you a huge advantage over bare-metal JavaScript.

Then there is node.js, which is essentially the engine most hardware vendors add to their SoC to JavaScript enable their devices. Node.js has been supported since version 2.0, and allows you to write a whole host of platform independent projects. You can write Linux servers, Linux Services (daemons as they are called), Windows services — anything you can think of really.

But naturally, you need to get a book on node.js and Espruino to know how to use these project-types properly. But they are all there and once you get into node.js and what you can do, the world really is your oyster.

The next update to Smart Mobile Studio

We are working very hard on getting the next version of Smart Mobile Studio ready for x-mas. While there will be bug fixes to the IDE (and a few new features as well), this update is primarily an update for the RTL and run-time library. We have tried very hard to keep things compatible with previous versions, but there will be changes that requires a bit of editing. But believe me, it will be worth it.

Here are some of the highlights:

  • Better fragmentation of classes and unit files
  • Namespace orientation
  • New visual components
  • Unified filesystem classes
  • A full overhaul of all visual controls
  • Plenty of bug fixes
  • Faster execution time
  • Better resource handling
  • Wiki documentation!

Stay tuned for more in-depth look at all the new classes and the features they provide.

As a bonus, Jon Lennart Aasenden have decided to give his upcoming book, Smart Mobile Studio Unleashed, for free to registered customers. The book will retail for $33 on Amazon. So if you want to learn the inner secrets of the VJL (visual JavaScript component library), how to write kick-ass custom controls – all the way to scalable, cluster based node.js services, this is THE book to get.

(*) the statements and articles on Jon’s personal devlog is not affiliated with this company. His blog is a personal blog which covers a variety of topics.

Book Espruino Inheritance IOT javascript JavaScript of things node.js Update

Partial classes, the smart way

Posted on 25.10.2016 by Jon Lennart Posted in Developers log, Documentation, News

Smart Mobile Studio have had support for partial classes for quite some time. It’s already an integral part of our run-time library and brings invaluable features to how we extend and work with the base system. But for those new to this concept, a short introduction is in order.

What is a partial class?

A partial class is, essentially, that you divide the implementation of a class into smaller pieces. These pieces can reside in the same unit or across multiple units of your codebase. When the compiler encounters a class marked as partial, it will wait until the compilation is complete before it seals the virtual method table for that class.

That sounds very technical, but it’s really super easy to use and you dont have to get into the nitty-gritty of things to take advantage of the fantastic new abilities it gives you.

You may ponder what on earth is the use for something like this? Well, first of all it allows you a finer grain of control when dealing with multi-platform support. Let’s say you have some code that you need to work on both visual (SmartCL namespace) client applications and server-side (node.js) as well. Naturally SmartCL depends on the document object model (DOM) being present, but under node.js there is no such thing. If you try to use the units prefixed with SmartCL.* under node.js, it will either crash the server or produce some spectacular access violations.

With partial classes you can solve this quite elegantly by putting the base-class in one unit, and then finish the class in separate units: one for browser-based code and the other for node.js based environments.

Extending functionality

But the power of partial classes is not really in organization. The above example could just as easily be solved with some clear-cut compiler defines. Not as elegant, but just as effective. The real power is in how partial classes can extend any class which is defined as partial. Like TW3CustomControl, which is the foundation for all visual controls.

Let’s say you want to add a function for fading out any control. Not just a single control, but all controls (since all visual control inherit from TW3CustomControl, any addition to that class affects all descendants equally). If you take a look at the class (which is found in SmartCL.Components.pas) you will notice that it’s marked as partial.

  TW3CustomControl = partial class(TW3MovableControl)
  ..
  ..
  end;

That means that we can extend the class at any time. So if we add the following code to one of our units:

type
  TW3CustomControl = partial class(TW3MovableControl)
  public
    procedure FadeOut;
  end;

procedure TW3CustomControl.FadeOut;
begin
  // Add code here
end;

Hit compile so the compiler picks up on this, and voila – the code suggestion will now show the new member FadeOut() for all controls. Every control that inherits from TW3CustomControl gets this new member. That is pretty cool! You could ofcourse do something similar with a class helper (which Smart Mobile Studio also supports), but the difference between a class-helper and a partial class is quite radical.

A class helper is not a true member of a class, it’s more (as the name implies) a helper that operates around an instance. But a partial class is the class itself, with full access to protected and private members. You have just told the compiler that “oh by the way, add this to TW3CustomControl”. Any class defined as partial will not have it’s VMT sealed until the very last moment.

Need to extend that websocket client you find lacking? Well, if it’s marked as partial you can extend the class as you see fit without messing about with the RTL. It’s also a good way to extend the copyrighted RTL with new features that can be sold and distributed as a package. You wont violate anything because you are using partial classes!

Incidentaly this is how Mono C# solved the problem of targeting Android and Apple iOS from the same codebase. We have done more or less the same in our upcoming RTL where we introduce 3 distinct namespaces. So there is a lot of goodies in the bag for x-mas 🙂

Effects

If you add the unit SmartCL.Effects.pas to your project you will notice something very cool! Namely that TW3CustomControl suddenly get’s around 30 new members. These are special effects methods that will help you write some truly amazing controls. Want a button to shake when the user touches it? No problem. Want a panel to fade out, or perhaps slide off to the right? Easy as apple pie. Just open up SmartCL.Effects.pas and have a look. You can even daisy-chain effects to each other (with callbacks and duration settings) and Smart will execute them in sequence (!)

Verdict

I hope this introduction to partial classes was helpful and that it enriches the way you write Smart solutions. Naturally there is more than one system for partial classes on the market. C# has a slightly different take on this technology. But personally and speaking from experience (I have worked quite a lot with Mono C#) I feel our variation on the theme is better. You have to type more in C# to achieve what Smart does in a couple of lines, and the level of control you have is just awesome.

And ofcourse: It makes it that much easier to deal with multi-platform code, which is what our next updates is all about.

Logistic problems

Posted on 21.10.2016 by Jon Lennart Posted in Announcements, News

We have been experiencing some logistic problems with our service desk for a while; Sadly we were only able to verify the magnitude of this today.
Apparently our Zendesk account have had problems forwarding messages, and as such – there is a substancial number of emails and messages that we quite frankly havent had access to until now.

We will be going through the backlog in the coming days and weeks, and we apologize to all that have contacted us without getting a proper response.

Regards

The Smart Mobile Studio Team

announcement

NodeJS server programming

Posted on 26.09.2016 by Jon Lennart Posted in Developers log 3 Comments

Work is progressing at a steady pace, and one of the aspects of the new Smart Mobile Studio is how the RTL is cleverly organized into namespaces.

Now it’s to early to spill the beans on all the new stuff, but in short we reached the point where we had to make some radical changes in order for the product to grow and reach its full potential. So far our RTL has aimed at the much loved VCL/LCL component architecture. This is not going to change at all, but how things are organized just had to be dealt with at some point. The longer we wait, the harder it’s going to be to introduce new features.

Namespaces

In the new model we have a clear distinction between visual and non-visual units. Visual units (or code in general) depends on the document object model (DOM) being present. As you probably know, non-visual environments like Node.js and IO.js doesnt have a document object model. These are primarily designed to run server code. They are also used to write actual system services (specially on Linux where turning a script into a background service is easy) or command line scripts.

Add to that technologies like Cordova Phonegap and Espruino (micro controller); then hybrid systems like nodewebkit, and you probably understand how important a clear separation of concepts and code is. But im not going into the nitty gritty of this now.

NodeJS and server side programming

Smart Mobile Studio have shipped with a node.js project type for some time. It throws you in at the deep-end of JavaScript programming, with nothing but the low-level header files to work with. This is fine if you are a JavaScript guru and know node intimately. But working on the level of headers and external declarations is not really user friendly. When you need to finish a server by next week, one that scales and can be clustered (which is just so powerful that I find it hard to describe just how cool this is) – you dont want to fiddle around with header files.

Well, soon you wont have to! In fact, as of writing I’m testing the first server type (http) and it’s performing brilliantly. Its a pleasure to write this part of the RTL !

Nodejs rocks! And with Smart Pascal, it rocks even more!

Nodejs rocks! And with Smart Pascal, it rocks even more!

A simple Node.js server

So, what does the most basic node.js web service look like? It’s almost to easy:

  var server := TNJHTTPServer.Create;
  Server.Port:=80;
  Server.OnAfterServerStarted:= procedure (sender: TObject)
    begin
      console.log("Server has started, listening on port:" + TNJHTTPServer(Sender).Port.toString);
    end;

  Server.OnRequest := procedure (Sender: TObject;
      const Request: TNJHttpRequest;
      const Response: TNJHttpResponse)
    begin
      console.log("-------------");
      console.log("Handling request:");
      console.log(request.Method);
      console.log(request.Url);
      console.log(request.Socket.remoteAddress);
      console.log("Listing headers:");
      for var x:=1 to request.headers.count do
      begin
        console.log(request.headers.Items[x-1]);
      end;
      console.log("-- OK");
      var LText:= "Your headers are:" + #13
        + Request.Headers.ToJSON() + #13
        + "All done.";
      response.end(Ltext);
    end;

  server.Start;

And that’s just one type of server. The really exciting stuff is when you dig into websocket and use socket.io to design your protocols (and clustering!). You can even setup events on both sides that trigger on spesific message types. Forget about heavy duty threading models — all of that is done for you. All you have to do is write the actual service.

Benefits of Node.js

Hosting node services costs next to nothing. Hosting providers are a dime a dozen and you can forget about those nifty prices you normally pay for pure executables (like under Delphi or Lazarus). So there is a huge financial aspect to take into consideration here as well, not just technical jargon. Node services can be moved, they are platform independent and couldnt care less if you use Linux or Windows, Amazon or Azure: as long as node is installed your good to go!

And last but not least: inter-communicating with existing services that are modern, and delivering solutions to your customers that talk JavaScript, Delphi, C++, C# or whatever their preference may be.

So good times ahead!

Cordova HTML5 javascript node.js nodejs rtl Smart Mobile Studio socket.io

That installer thing

Posted on 23.09.2016 by Jon Lennart Posted in Developers log

Smart Mobile Studio can be downloaded as a traditional installer-file for Microsoft Windows. This works quite well, especially when doing a clean install, and it would be very odd not to provide an installer in 2016.

However, we do get feedback from people that experience problems with this. Not the installer itself, but rather when they update their system by just installing on-top of an older installation, things become problematic. In short: depending on just how old that installation is, it can be plain sailing or a frustrating experience.

In newer versions of SMS you dont need to download a new installer

In newer versions of SMS you dont need to download a new installer

A while back we introduced the concept of “live updates”. In short Smart Mobile Studio ships with an automatic update application that makes sure you have the latest executables, the latest RTL and that your libraries are always fresh off the mint. Each version of Smart has its own channel inside the update program. The value of such a system is naturally that you dont have to keep on downloading installers, punch in the serial number – or that we accidentally overwrite or delete your own library files. The updater will only deal with the files known to it’s RTL, and leave your work in peace.

File IO is not just write and forget

Windows abound

Windows abound

Windows is not what it used to be. I personally think Windows has embraced the concept of users, access rights and credentials quite well (although Windows Vista made me leave the platform for Ubuntu Linux for a while). But all in all, Windows 7, 8 and 10 are a joy to use.

However, writing an installer that should be compatible with the majority of Windows systems (as many as possible) is not actually straight forward.  There are still things like credentials, roaming and non-roaming profiles, read/write rights, elevated users and functionality requiring admin notification (not to mention access bits on the filesystem itself); So a Windows box in Indonesia is not nessacarily identical to a Windows box in north America.

Microsoft have clear cut rules established for what paths to use when installing software. Smart Mobile Studio follows those rules always, but just because you follow the rules, doesnt mean that the user’s credentials (which propagate into everything he/she does) allows you to write all the files. This is where elevation comes in; Something that is finally easier to deal with in Delphi, the compiler we use to make Smart Mobile Studio.

We have seen people try to install Smart Mobile on thin clients and chrome-books, on roaming profiles in a corporate environment to their old Windows 98 machine. To make a long story short: modern Windows can be configured to be just about anything, and when installing a development platform you really need a normal PC without those restrictions. A developer machine.

Older installations

One of the biggest problems we have had and something that is topping our “how to” question chart, is when they have an ancient version of Smart Mobile Studio on their harddisk (anything from the first beta through version 2.0). This was before we added the automatic update program, and more importantly — the preferences files and dll files have since been utterly re-designed.

So they install the new version thinking it will replace some 3-4 year old install. But fact is, the installer will not overwrite the preferences file, and in many cases its not allowed to delete/replace the dll files. The old software prior to the update program must be manually un-installed through Windows before you install a more modern version (!)

What typically happens is that the old preferences file is left lingering on the system, the new executable tries to read it but finds none of the values it expects. This causes conflicts inside SMS, the server in particular is sensitive to this (which will be made more robust). This is not critical stuff, but annoying.

Using an old preferences file on a new exe will cause problems

Using an old preferences file on a new exe will cause problems, this is a typical stacktrace

The secondly, more critical, is when the older DLL files for the webkit rendering engine is left to linger. That means the header-files we use to talk with the DLL files wont match, causing a serious and show-stopping exception.

Again, manually uninstall the older version first. Then go into your “program files” folder and make sure to delete it completely. Same goes for “program data” (or appdata local or roaming). And last but not least, “user data” where library units, the RTL and various other tidbits are stored.

Using the update program

If you have a newer version you really dont need to download and use the installer. Simply start the update program and it will download the latest files. But its vital to remember that if you have made manual changes to the RTL files (which technically you shouldnt, but we dont mind as long as you stick to the license agreement for copying) – the update program will overwrite those files.

The point of the update program is to make sure the RTL, libraries, shims and IDE executable is the latest. It wont touch files that doesnt belong to SMS.

HTML5 Installer Object Pascal OP4JS Smart Mobile Studio

Smart Mobile Studio 2.2 Hotfix 2

Posted on 18.04.2016 by gabr42 Posted in Announcements, Developers log, News

As it turned out, the recent Smart Mobile Studio 2.2 Hotfix 1 introduced a big problem. Because of a regression bug in the compiler, generated programs are sometimes incorrect and don’t execute. To fix that are pushing out Hotfix 2 which contains all the updates of Hotfix 1 except the DWScript compiler which was reverted back to version 2.2.

To update, you can rerun the SmartUpdate utility [more information] or download the installer from the following locations:

  • Smart Mobile Studio 2.2 installer
  • Free command-line compiler

Changes

  • Reverted compiler to version 2.2 to fix code generation problems.
announcement Hotfix release

Pages

  • About
  • Feature Matrix
  • Forums
  • News
  • Release History
  • Download
  • Showcases
    • The Smart Contest 2013, Round 1 – Graphics
  • Store
  • Documentation
    • Creating your own controls
    • Debugging, exceptions and error handling
    • Differences between Delphi and Smart
    • Get the book
    • Getting started
      • Introduction
      • Local storage, session storage and global storage
      • Application architecture
      • The application object
      • Forms and navigation
      • Message dialogs
      • pmSmart Box Model
      • Themes and styles
    • Layout manager
    • Networking
      • Loading files
      • TW3HttpRequest
      • TW3JSONP
    • Prerequisites
    • Real data, talking to sqLite
    • System requirements
    • Project types
      • Visual project
      • Game project
      • Console project

Archives

  • December 2019
  • December 2018
  • November 2018
  • July 2018
  • June 2018
  • February 2018
  • September 2017
  • April 2017
  • November 2016
  • October 2016
  • September 2016
  • April 2016
  • March 2016
  • January 2016
  • October 2015
  • September 2015
  • July 2015
  • April 2015
  • January 2015
  • December 2014
  • October 2014
  • September 2014
  • August 2014
  • July 2014
  • June 2014
  • March 2014
  • February 2014
  • January 2014
  • December 2013
  • November 2013
  • October 2013
  • August 2013
  • July 2013
  • June 2013
  • May 2013
  • April 2013
  • March 2013
  • February 2013
  • January 2013
  • December 2012
  • November 2012
  • August 2012
  • July 2012
  • June 2012
  • May 2012
  • April 2012
  • March 2012
  • February 2012
  • January 2012
  • November 2011
  • October 2011
  • September 2011

Categories

  • Announcements (25)
  • Developers log (119)
  • Documentation (26)
  • News (104)
  • News and articles (16)

WordPress

  • Register
  • Log in
  • WordPress

Subscribe

  • Entries (RSS)
  • Comments (RSS)
  • 1
  • 2
  • 3
  • …
  • 13
  • Next
© Optimale Systemer AS