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

Themes and styles

Themes

Themes

All html entities with the exception of the HTML5 canvas element, are visually defined by CSS (cascading style sheet) styles. In short a stylesheet is a collection of individual styles (hence the word “sheet” as in a sheet of notes), where each style is a list of pre-defined attributes. All TW3Customcontrol decendants have sub objects which wraps the basic styles:

  • Border property (TW3Borders)
  • Background property (TW3ControlBackground)
  • Font property (TW3ControlFont)
  • Color property (TColor type)
  • Opacity property (Integer type, alpha blending)
  • BorderRadius property (Integer type, round edges)

But if you want a more dedicated look you are best served by writing your own style. As mentioned above a style is, simply put, a way to pre-define visual aspects of a control. A very simple style could be like this:

[sourcecode language=”css”]
.TMyButton {
/* red font color */
color: #FF0000;

/* black background color */
background-color: #000000;

/* Font: the browser will try from left to right in the list */
font-family: "Helvetica Neue", Helvetica, sans-serif;
}
[/sourcecode]

If you look at some of the more advanced CSS examples on the internet, like the stylesheet files that ship with native javascript frameworks like JQTouch – you can easily get the impression that this is really, really complex and hard to understand. But the complexity that haunt packages like JQTouch is largely due to the fact that javascript doesnt support code classes at all. In fact, vanilla javascript support very few of the features you get from smart mobile studio. The reason we can provide advanced things like classes, inheritance, interfaces and closures – is because we have sculpted these features in javascript itself.

Since we take care of behavior through our code and not through complex css condition mapping (also known as CSS selectors), we are left with the bare minimum when it comes to CSS styling. Smart has a clever style system which is extremely simple but effective. Whatever the name of your class is – that is the name of the style it will adopt. So if you create a new visual control and call it TMyButton – when that control is created it will automatically use the style “TMyButton” from the stylesheet (note: it expects this style to be defined in your project’s “app.css” file).

If you want to override this behavior you can achieve this by:

  1. Alter the styleclass property
  2. Override the method StyleTagObject() and manually alter the styles

Rolling your own themes

Smart ships with a stylesheet designed to look like iOS. Whenever you create a new project this file is duplicated and inserted into your project as “app.css”. If you have some experience with CSS you can modify the stylesheet to your own preference. When you are done editing it, simply copy the new stylesheet as a new file into the themes folder (stored under “c:/appdata/optimale systemer as/smart mobile studio/rtl/themes”) you can then select this as a project theme for other projects. The theme can either be selected when you create a new project – or altered at any time in the project options dialog.

Project options theme selection

Project options theme selection

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