To continue with this content, please log in with your Data Access ID or create a new account.
Cancel Data Access ID
You may not be authorized to see this content. Please contact Data Access Europe for more information.
Cancel Data Access Europe
You are not authorized to see this content.
Cancel Data Access Europe
Next lesson:
Styler
Cancel

The CSS and HTML Secrets of DataFlex WebApps

Lesson 4 - Framework structure

A summary of the video course

In this lesson, we'll explore the structure of the web framework used in DataFlex for building web applications. This framework is responsible for creating the user interface of your web apps.

Web App Framework Basics

When you build web applications with DataFlex, you utilize the Web App Framework. This Framework is essentially a user interface (UI) framework controlled by DataFlex on the server.

Web Framework Controls

The Web Framework revolves around controls, which are the building blocks of web applications in DataFlex. Controls include elements like web forms, web buttons, web lists, and web grids. These controls are implemented in JavaScript and generate HTML elements dynamically.

Control Example

Let's take a look at an example. Suppose you define a DataFlex object as a web form, set its properties, and run the application.

The web form control will generate HTML code during runtime. This code includes various <div> elements that encapsulate the control's structure.

Layout Systems

The Web Framework features two layout systems:

  • Column Layout: This is a flow-based layout that uses CSS float to position elements.
  • Panel Layout: It consists of panels, each capable of containing other panels or controls. Controls cannot be siblings to panels. Panels include the center panel, top, left, right, and bottom panels.

CSS Structure

The Web Framework's CSS structure has multiple layers:

  • System CSS: Found in the HTML folder (DFEngineSystem.css), this CSS is essential for control functionality.
  • Theme CSS: Built on top of system CSS, it defines colors and themes for controls.
  • Custom CSS Classes: These are application-specific CSS classes, often placed within Application.css.
  • DataFlex Properties: These directly translate into inline CSS and override other styles.

Styling the Framework 

When styling the Framework, you primarily work with CSS and themes to control the look and feel of your web application. The Framework manages the HTML structure and layout, while CSS and themes influence the appearance.

Creating a Workspace 

To get a hands-on understanding, you can create a new workspace and project within DataFlex. This workspace will provide you with the necessary structure for web application development.

Workspace Structure 

After creating the workspace and project, you'll notice a folder structure with an AppHTML folder, index.html, and other files. This structure is essential for web app development.

Running the Default Application 

Create a Mobile Web Project and when you run the default application generated by DataFlex, you'll observe that it includes controls like a login screen, dashboard, toolbar, and menu. These are created by the Web Framework.

In the AppHtml folder we now have:

  • An Index.HTML: which is the default entry point
  • The JavaScript Engine (DfEngine): which holds JavaScript files that are JavaScript implementations of the controls
  • The system.css
  • CssThemes: the themes that come with the Framework
  • CssStyle: an empty application, which you can use to add your own classes

Inspecting Elements 

Opening the AppHtml with Visual Studio Code, you see that the by default the page includes quite some elements and settings already.

Compile and run

When compiling and running the application the application comes with a login screen by default.

Now we see the default dashboard, toolbar and the menu system.

With the inspector you can inspect elements created by the Framework. For example, you'll find that controls like breadcrumbs are implemented as <div> elements with specific CSS classes generated by the Framework.

Framework Overview 

The Web Framework in DataFlex dynamically generates HTML elements and controls their layout. It relies on CSS and themes for styling. As a developer, you work within this Framework to build the UI and customize its appearance.

In the next lesson, we'll explore the DataFlex Styler, which allows you to create custom fields and further customize your web application. Stay tuned!