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

Monthly Archives: March 2013

Smart Mobile Studio 1.1

Posted on 15.03.2013 by Smart Mobile Studio Team Posted in News
Smart Mobile Studio 1.1

Smart Mobile Studio 1.1

We are proud to release Smart Mobile Studio 1.1 to the general public (build 1.1.0.911).

You can download the product here

Notes

  • Remember to update the css and html in your projects after updating (right click file in the ide, click “revert to default”)
  • Remember to back-up any units you have stored in either the RTL or Libraries folder before you install
  • Remember to re-build the RTL index database after installation to examine the new classes and units in the classbrowser
  • Since all controls now exist in their own RTL units, some projects might require you to alter the uses section manually (the easiest way is to drop a control onto the designer, as this will add the unit automatically for you).
  • You can now use curley brackets in ASM sections

Changelog

  • Fixed: TW3Canvas.toDataURL
  • Added: L-System Fiddle demo
  • Added: URI functions
  • Fixed: installer script backs up libs + RTL
  • Fixed: Allow adjusting tab height
  • Added: Active property to pause animation
  • Added: w3Elements.pas  &  elements controls to toolbar
  • Improved JS SetLength for arrays of simple types
  • Re-committed latest WebIDL code
  • Fixed: browser render bug. Was in fact the onNeedsInclude event that needed a modification
  • Added: registered various controls
  • Fixed: unit parser
  • Added: some automatic Web IDL translations (manual work necessary!)
  • Fix: empty names for anonymous methods in unitparser
  • Clarified error messages
  • Initial version of unit test demo (text runner)
  • Updated unit test framework. Unpublished methods that didn’t need published status (now)
  • Fixed: CTRL+V missing from SearchAndReplaceDialog -> ComboBoxSearch
  • Added unit tests
  • SmartUnit now reached initial working state
  • Added time properties
  • TestFramework initial version
  • Added property read write syntax with automatic anonymous field declaration
  • Fixed case for strict hints
  • FastInt64ToStr RTTIMethodAttribute.Call MultByPowerOfTwo expression
  • Minor codegen improvements & cleanup
  • Fixed case for strict hints
  • Added missing units
  • Fixed case for strict hints
  • Updated: CSS theme for latest components + cleanup
  • Added “case of boolean” optimization to if/then/else Improved if..then condExpr optimization for the CodeGen
  • Reintroduced as unit namespace, please complete with missing units from former W3Ctrls unit!
  • Fixed name case
  • Fixed case for strict hints
  • Extended if then optimization to if then else
  • Added RelIntIs(Not)
  • Zero optimization Fixed for non-prototypable fields in external classes
  • Added initial RTTI for methods
  • Improved error reporting when crash occurs during optimization
  • Improved CodeGen for
  • “if” on assigned & int<>0 checks
  • Layout and widget updates
  • Updated: Added check and callback timer to scrollbox so that it initializes when the form is ready (if the contentbox holds elements).
  • Added: childadded + childremoved methods to TW3Component
  • Added: W3_DOMReady function in W3System.pas
  • Altered: cleaned up the use of w3ctrls in various RTL units
  • Altered: All components are now in their seperate units
  • All controls seperated into units
  • Fixed minor memory leak
  • Fixed json array clear
  • Altered: Basecompiler changes Lost: vertical scrollbar (!) damn svn?
  • Fixed external form issue in background compiler & some refactorings in compiler unit
  • Fixed missing initial background compilation for new projects
  • Added: *.inc files to repository
  • RTL Backup before splitting components into their own unit
  • Added: debug logging of background compiler error messages &  added more user warnings in case such errors appear.
  • JSON.Stringify did not work with obfuscation
  • Accept initialization/finalization as end markers for a type declaration block
  • Added: simplified helper syntax
  • Delete unused file (QR code was used as test)
  • Added: QR code generation for server window
  • Moved remaining forms to source directory (below new subdirectory ‘window’, as these are no dialogs)
  • Removed unused dependency WIP on new flowing components
  • Fixed smart-linking not properly filtering the main program, initialization & finalization sections (relevant when types or functions where declared there, but not used)
  • Fixed codegen for multi-dimensional dynamic arrays
  • Improved symbol dictionary discrimination between forwards & declarations
  • Fixed requestAnimationFrame support for IE8-9 and others
  • Fixed hints for strict mode
  • Added: TW3CustomScrollBar Class
  • Added: TW3VerticalScrollbar
  • Altered: Tweaked CSS, more firefox styles
  • Altered: Added css for scrollbar
  • Improved unit test coverage
  • Test manual execution of the automatic build #2
  • Test manual execution of the automatic build
  • Added: The switch control is now added to the toolbar palette
  • Altered: The TW3ToggleSwitch transition now uses the w3_CSSPrefix so it also works on other browsers
  • Altered: minor changes to the toggle-switch. Delayed event callback more in sync with the css animation + destructor
  • Added: TW3ToggleSwitch control
  • Altered: Updated the CSS stylesheet with toggle css classes
  • Added: requestAnimFrame added to drivers
  • Improved unit test coverage
  • Support asm blocks with curlies in them
  • Add support for deactivating curly comments in Pascal tokenizer
  • Tokenizer tests moved to own unit
  • Fix for anonymous symbols acquire in a class var ExprBase
  • Fixed: Adjustment error in TW3HeaderControl fixed
  • Improved errors for null read/write expressions
  • Fixed: Layout difference between offline & online rendering
  • Fixed: Added callback for control adjustment (important!)
  • Added: supportAdjustment method to TW3MovableControl
  • Altered: AdjustToParentBox now checks supportAdjustment
  • Altered: TW3ProgressBar is not affected by AdjustToParentBox
  • Fixed: missing adjustToparentBox
  • Added: internet explorer driver
  • Added: requestAnimationFrame in driver API
  • Disabled trigger and delayed start for code templates (should never work this way)
  • Added Layout.Center
  • Added: script to flush the target RTL folder when updating
  • Added NoRTTI option and slightly rearranged options dialog (compiler options contain only compiler options now, etc.), also added new tab for the linker (as there will be more options in the future for sure)

Sincerely,
Jon Lennart Aasenden
—
The Smart Mobile Studio Team

Creating a TScrollbox

Posted on 05.03.2013 by Jon Lennart Posted in News

The interface of the TW3Scrollbox:

unit w3scrollbox;
 
interface
 
uses w3system, w3components, w3graphics, w3scrollbar;
 
  //Default size of the scrollbars
  const
  CNT_SCROLLBAR_SIZE  = 18;
 
type
 
  TW3ScrollBoxContainer = Class(TW3CustomControl)
  End;
 
  TW3Scrollbox = Class(TW3CustomControl)
  Private
    FHScroll: TW3HorizontalScrollbar;
    FVScroll: TW3VerticalScrollbar;
    FContent: TW3ScrollBoxContainer;
    Procedure HandleScroll(sender:TObject);
    Procedure UpdateWhenReady;
  protected
    procedure ChildAdded(Const aChild:TW3Component);override;
    procedure InitializeObject; override;
    procedure FinalizeObject; override;
    procedure Resize; override;
  public
    Property  Content:TW3ScrollBoxContainer read FContent;
    Procedure Update;
  End;

Since all the child objects will be created runtime via the constructor in Smart, the JavaScript browser code might not be ready when ChildAdded() is called (which is invoked whenever a child control attach as a child). The “UpdateWhenReady” method will wait until both the DOM (document object model) and TApplication instance is truly ready, and then it will automatically update the scrollbars if there is any content that is larger than the client-area.

Take a look at the implementation:

implementation
 
 
  //###########################################################################
  // TW3Scrollbox
  //###########################################################################
 
  procedure TW3Scrollbox.InitializeObject;
  Begin
    inherited;
    FContent:=TW3ScrollBoxContainer.Create(self);
 
    FHScroll:=TW3HorizontalScrollbar.Create(self);
    FHScroll.OnChanged:=HandleScroll;
    FHScroll.visible:=False;
 
    FVScroll:=TW3VerticalScrollbar.create(self);
    FVScroll.OnChanged:=HandleScroll;
    FVScroll.visible:=False;
 
    //UpdateWhenReady;
  end;
 
  procedure TW3Scrollbox.FinalizeObject;
  Begin
    FHScroll.free;
    FVScroll.free;
    FContent.free;
    inherited;
  end;
 
  procedure TW3Scrollbox.ChildAdded(Const aChild:TW3Component);
  Begin
    inherited ChildAdded(aChild);
    UpdateWhenReady;
  end;
 
  Procedure TW3Scrollbox.UpdateWhenReady;
  begin
    if (w3_DOMReady=False)
    or (ObjectReady=False) then
    w3_callback(updateWhenReady,10) else
    w3_callback(Update,1);
  end;
 
  procedure TW3Scrollbox.Resize;
  var
    wd,hd:  Integer;
  begin
    inherited;
    wd:=clientWidth;
    hd:=clientHeight;
 
    if FHScroll.visible then
    dec(hd,CNT_SCROLLBAR_SIZE);
 
    if FVScroll.Visible then
    dec(wd,CNT_SCROLLBAR_SIZE);
 
    if FHScroll.Visible then
    FHScroll.setBounds(0,hd,wd,CNT_SCROLLBAR_SIZE);
 
    if FVScroll.Visible then
    FVScroll.setBounds(wd,0,CNT_SCROLLBAR_SIZE,hd);
 
    FContent.SetBounds(1,1,wd-2,hd-2);
  end;
 
  Procedure TW3Scrollbox.HandleScroll(sender:TObject);
  Begin
    FContent.ScrollInfo.ScrollTo(FHScroll.Position,FVScroll.Position);
  end;
 
  Procedure TW3Scrollbox.Update;
  begin
    BeginUpdate;
    try
      if FContent.ScrollInfo.ScrollWidth>FContent.ClientWidth then
      Begin
        FHScroll.Total:=FContent.ScrollInfo.ScrollWidth;
        FHScroll.PageSize:=FContent.ClientWidth;
        If not FHScroll.Visible then
        Begin
          FHScroll.Visible:=True;
          self.SetWasSized;
        end;
      end;
 
      if FContent.ScrollInfo.ScrollHeight>FContent.clientHeight then
      Begin
        FVScroll.Total:=FContent.ScrollInfo.ScrollHeight;
        FVScroll.PageSize:=FContent.clientHeight;
        If not FVScroll.Visible then
        Begin
          FVScroll.Visible:=True;
          SetWasSized;
        end;
      end;
 
      FContent.SendToBack;
 
    finally
      EndUpdate;
    end;
 
  end;
 
end.

Using the scrollbox (without the designer) is straight forward. In this case I added a Beatles poster as a resource, inserted an image into the content of the scrollbox – and used the image as a background (as opposed to the image itself. Neat trick!).

FBox:=TW3Scrollbox.Create(self);
FBox.SetBounds(10,200,600,500);
FBox.StyleClass:='TW3CustomControl';
 
FTest:=TW3Image.Create(FBox.Content);
FTest.Background.FromURL('res/beatles.jpg');
FTest.setBounds(0,0,1644 * 2, 1086 * 2);

Creating a scrollbar

Posted on 04.03.2013 by Jon Lennart Posted in Developers log, News

So, what is a scrollbar? In short it consists of 4 parts: an up arrow, a region to move a handle, the handle, and a down arrow. The hard part is not to draw or setup the actual control, but to translate between screen coordinates and the values the scrollbar represents. The scrollbar might represent 100000 items of “something”, but since you have (for instance) only 400 pixels to represent that sum – you have to translate between the visual and the abstract.
Continue reading→

Creating a toggle switch

Posted on 03.03.2013 by Jon Lennart Posted in Developers log, News

Smart Mobile Studio component writing is actually very simple. It’s much easier than under Delphi – but it involves one aspect that to some Spartans can feel.. well, a bit odd. Namely the fact that you have to take CSS into account.
Continue reading→

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)
© Optimale Systemer AS