hub.eb?material_id=744

Developing with Themes


Themes are important entities in Verj.io that define the look of your application.

Forms in a Project can be styled consistently by configuring a Project Theme and setting the Forms to inherit it.

To set a Theme for a Project, right-click on the Project in the Entity Tree and click Properties.

Clicking on the Theme properties button enables you to select any Theme from this or any Linked Project as this Project's Theme.

A Form can use its owning Project’s Theme by opening the its Form Properties dialog and selecting the Project Theme option in the Presentation tab.

If the Project is updated to use a different Theme, then the Form will automatically switch to use the new Theme.

Workspace Preferences

The Workspace Preferences dialog can be opened by selecting File > Workspace Preferences from the main menu.

Any Theme in the Workspace can be set as the Theme for all new Projects by setting the Theme property.

The selected Theme can be from any Project in the Workspace. When a new Project is created this Theme is automatically configured to be its Theme, and a link to the Theme’s owning Project is automatically created in the new Project.

New Forms created in the Workspace will automatically be configured to use their owning Project’s Theme if the Use Project Theme property is checked.

Using these Workspace preferences means every time you create a Project or a Form it uses the same Theme as the rest of your application.

Using Themes in this way makes an application’s styling consistent, both in terms of the rendered web page but also in terms of developing them. Additionally, it means that changes to that Theme (for example a change in colour) will automatically be applied to all Web Pages in your application.

It also makes it much easier to offer an end-user the ability to switch the current Theme, for example between a light and dark mode.

Workspace Preferences are specific to the current Workspace, so if you switch to a new Workspace a different Theme can be configured.

Steps


1

If you haven't already, complete the Steps in the Workspace Basics Tutorial before starting these Steps.

Switch to your verjioTutorials Workspace if you haven’t already:

  1. Click File > Switch Workspace.
  2. Select verjioTutorials
  3. Click OK.
2

Create a new Project called shared, if it doesn't already exist:

  1. Click New .
  2. Select Project.
  3. Name your project shared
  4. Click Finished.
3

Download a Theme into a themes Folder in this Project:

  1. Right-click on the shared Project and select New > Folder.
  2. Name the Folder themes.
  3. Right click on the the themes Folder and select New > Theme.
  4. Select the Boostrap 5 > Corporate > 2-Colour > Verj.io Light.
  5. Name the Theme light.
  6. Check Set as current Project's Theme.
  7. Check Set as Theme for New Projects.
  8. Click OK

At this point your Entity Tree should look like this:

4

Configure new Projects to use the light Theme by default and make all new Forms use their owning Project's Theme.

  1. Open the Workspace Preferences dialog by pressing File > Workspace Preferences in the main menu.
  2. Click on the ... button next the New Projects Theme property.
  3. Select the light Theme from the shared Project.
  4. Make sure the New Forms Use Project Theme property is checked.

    Your Workspace Preferences should look like this:
  5. Click OK.
5

Create a new Project called themeBasics, if it doesn't already exist:

  1. Click New .
  2. Select Project.
  3. Name your project themeBasics
  4. Click Finished.
  5. Right-click on the themeBasics Project and select Properties.

    The Project Properties dialog should look like this, with light set as the Theme and shared added as a member of Linked Projects:
  6. Click OK if you have made changes, otherwise Cancel.
6

Create a new Form called developingWithThemes in a developingWithThemes Folder in this Project:

  1. Right-click on the themeBasics Project and select New > Folder.
  2. Name the Folder developingWithThemes.
  3. Right-click on the developingWithThemes Folder and select New > Form.
  4. Name the Form developingWithThemes.
  5. Click OK.
  6. Click on the Form Properties button on the developingWithThemes Form's toolbar.
  7. Click on the Presentation tab and notice the Theme property is set to Project.

It should look like this:

7

Create a main section for Page_1:

  1. Select Page_1 from the  Pages View.
  2. Add a  Main by dragging it from the Palette into the Outline View as a child of the  Page_1 Page Control.
  3. Add a  Bootstrap Container as a child of the Main.
  4. Add a  Heading as a child of the  Main Bootstrap Container and write Developing With Themes in the Create New Control dialog.
  5. Add a  Button underneath the  Heading and write Test Button in the Create New Control dialog.

At this point, your Outline view should look like this:

8

Check to see the Button Control is getting its styling from the light Theme:

  1. Click on the Button Control in the  Outline View.
  2. Look at the Property Set property in the Button Control's Properties View. 
  3. Click on <Default>. This will open the Presentation Template from the light Theme, showing the default Property Set for the Button Control. See Presentation Template Basics and Property Set Basics for more information.
9

Test the Form in your browser:

  1. Press the Save All  button in the main toolbar. 
  2. Click the Test  button in the main toolbar and press Submit in the resulting dialog.
  3. The page will be presented using the light Theme's styling.

Related