ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / NotDocumented
  • Lesson 1 - Styles
  • Overview
  • Introduction to styles
  • A control: several elements
  • Discovering the styles via an example
  • Select control CSS styles
  • Editing the CSS style of a control
  • WEBDEV styles
  • Implementing styles: a practical example
  • Overriding the CSS style of a control
  • Modifying a CSS style for all controls
  • Styles and rich text

NotDocumented

Lesson 1 - Styles
We will cover the following topics:
  • CSS styles.
  • WEBDEV styles.
Durée de la leçon 1 h
Overview
WEBDEV helps you "design" your sites. To do so, you can use two types of styles:
  • CSS styles,
  • WEBDEV styles.
Using styles in your controls helps you save time: if you make changes to a WEBDEV or CSS style, all the controls that use that style are automatically updated.
Introduction to styles
Before using styles, let's take a look at the controls to which they will be applied.

A control: several elements

Each WEBDEV control includes several elements.

Let's take the Edit control as an example. This control includes three elements:
  • the caption.
  • the input area.
  • an additional area containing the caption and the input area.
    Style elements of an Edit control
How are the styles applied to the Edit control? Depending on the type of style (WEBDEV or CSS), it may be applied differently.
  • The CSS styles are applied to the control elements.
    For the Edit control, a specific CSS style can be applied to the caption of the edit control or to the input area.
  • The WEBDEV styles are applied to the entire control.
    A WEBDEV style includes several CSS styles.
    For example, for the Edit control, the WEBDEV style contains:
    • The CSS style for the caption,
    • The CSS style for the input area,
    • The different style options for the control global area.

Discovering the styles via an example

To discover the styles in WEBDEV, we will use a simple example:
  1. Go to the WEBDEV home page (Ctrl + <).
  2. On the home page, click "Tutorial", then in "Part 7 - Lesson 7.1 - Styles", double-click "Styles - Answers".
  3. Open the "PAGE_Styles" page in the editor.
  4. Open the description window of the "Last name" Edit control (select "Description" in the context menu).
  5. Select the "Style" tab. This tab allows you to define the control style characteristics.
  6. The following window appears:
    'Style' tab of an Edit control
This window allows you to define the CSS styles (section 1 of the window) and the WEBDEV styles (section 2 of the window) of the control. Let's take a look at the features of this window.

Select control CSS styles

To select the CSS styles of a control:
  1. In the "Style" tab of the control description window, in the "Element" combo box, select an element and set the desired style.
    Elements managed by the style
    Remark: All elements followed by "(CSS)" can use a CSS style directly: simply select its name.
  2. The "CSS style" combo box allows you to choose the CSS style of the element: this style will be applied to the element.

Editing the CSS style of a control

To create or edit a CSS style:
  1. In the "Style" tab of the control description window, click next to the "CSS Style" combo box.
    Create or edit a CSS style
  2. In the context menu that appears, select "Edit".
  3. The CSS style edit window opens.
    CSS style edit window
  4. This window allows you to create or modify all the CSS styles of the project.
Let's analyze this window. This window is divided into 2 areas:
  • Zone 1. The control state to which the style will be applied: normal, hover, active, etc.
  • Zone 2. The CSS properties associated with the selected state. Each CSS property can be modified for each state.
Let's check the characteristics of the CSS style named "MyCustomStyle_InputArea":
  1. Select the "MyCustomStyle_InputArea" style in the combo box of section 1 if necessary.
  2. Select "default" (first state in section 1).
  3. Go to the "Background" tab: the background color is white.
  4. Select "focus" (fourth state in section 1).
  5. In the "Background" tab, the background color of the input area is pastel yellow. The CSS style contains the style for each one of the states.
  6. Close the CSS style description window.
The "Style" tab of the control description window appears again. In the bottom section of the window, you can define the most frequently used style options:
Quick access to options
  • Font,
  • Size,
  • Bold, Italic, Underline, Strikethrough,
  • Vertical and horizontal alignment,
  • Background color.

Caution

These options are used to quickly override the CSS style of the current control. In this case, changing these options will not affect the other controls that use the CSS style.
You can override all the other properties of the CSS style via "+ overrides".
Now, let's discover the WEBDEV styles.

WEBDEV styles

A WEBDEV style includes several CSS styles. For example, for the Edit control, the WEBDEV style contains:
  • The CSS style for the caption,
  • The CSS style for the input area,
  • The different style options for the control global area.
To define the WEBDEV styles, use the panel displayed on the right of the control "Style" tab:
WEBDEV styles
The name of the WEBDEV style appears at the top of this window. It is possible to:
  • Choose an existing style.
  • Add the style of the current control to the project style sheet.
    This option allows you to reuse the style in other controls of the project.
  • Dissociate the control.
    This option prevents future style modifications from being applied to the control. This option is not recommended: we advise you to use style overrides.
The project skin defines a WEBDEV style for each type of control. This WEBDEV style can be used "as is" or it can be modified on certain control elements. .
For example, to make the caption of a specific Edit control bold, you must:
  • Select the "Caption (CSS)" element in the bottom section of the "Style" tab.
  • Select "Bold" in the bottom section.
This modification will not dissociate the WEBDEV style from the control: the Bold property will be overridden in relation to the initial style.
Therefore, if the initial style is modified (to change the background color, for example), the modification will be applied to the control while keeping the override.
To see the overridden elements, simply click the link that indicates the number of overrides applied to the control, at the top of the WEBDEV style panel.
Implementing styles: a practical example
After covering the basics, let's see how it actually works. We will create an Edit control and modify its styles in "PAGE_Styles" of the "Styles" project.
Remark: We will use an Edit control but the principle for manipulating styles can be applied to all controls available in WEBDEV.

To create the edit control:
  1. On the "Creation" tab, in the "Usual controls" group, click Create an edit control.
  2. Click where you want to create the control in the page.
This control is associated with a WEBDEV style (it is the default WEBDEV style defined in the skin chosen when creating the project).

There are three methods to select the WEBDEV style of a control:
  • Via the "Style" tab in the control description window (as seen previously).
  • Via the "Modification" tab of the ribbon: a preview shows the different WEBDEV styles available for the control.
    'Modification' tab of the ribbon
  • By selecting "Choose a WEBDEV style" in the context menu of the control.
    Editing the style sheet
We will use the last method to associate the new control with the "EDT_Custom" style. This is the style of all the other controls in the page.
  1. Select the control you have just created.
  2. Open the context menu of the control and select "Choose a WEBDEV style".
  3. In the window that appears, select the "Custom" style.
  4. Validate the style selection window. The color of the control caption changes: the style has been applied.
Save (Ctrl + S) and test the page (click Test a page in the quick access buttons).
  1. The page is displayed in the browser.
  2. Click the input area of the new Edit control: the input area changes to yellow.
  3. Close the browser.

Overriding the CSS style of a control

We will change the style of the control input area:
  1. Open the description window of the previously created control.
  2. In the "Style" tab, choose the "Input area (CSS)" element.
  3. Click "+ overrides" to override the CSS options of this element.
  4. Select the "focus" state.
    Style - States of an element
  5. In the "Background" tab, change the background color. Choose a pale purple color, for example.
  6. Validate. In the WEBDEV styles pane, the link (top right) indicates "1 override".
  7. By clicking it, you can see that the background color of the inside area was overridden.
  8. Validate the control description window.
Save (Ctrl + S) and test the page (click Test a page in the quick access buttons).
  1. The page is displayed in the browser.
  2. Move the cursor from one control to another: the background color is yellow for all controls except for the control that was just created.
  3. Close the browser.

Modifying a CSS style for all controls

We are now going to modify the CSS style of the input area in order to change the text color. We will make these changes for all the Edit controls of the page.
  1. Open the description window of the control you created (Alt + Enter).
  2. In the "Style" tab, choose the "Input area (CSS)" element.
  3. Click to the right of the CSS style name. In the menu that opens, select Edit". The CSS style editing window appears.
  4. Select the "default" state.
  5. In the "Text" tab, change the color. Choose a green color, for example.
  6. Validate and then validate the control description window.
Save (Ctrl + S) and test the page (click Test a page in the quick access buttons).
  1. The page is displayed in the browser.
  2. Type text in the different Edit controls of the page: the text is displayed with the new selected color. This change was applied even to the previously created control with the style that was overridden.
  3. Close the browser.
Styles and rich text
As for the appearance, you can also define rich text in the elements!
By using rich text, you can define different styles for the control caption. For example, you can specify that one part of the caption of an Edit control should use a specific color.
Let's take a simple example: add a red asterisk to specify that a control is a required field.

In our example:
  1. Select the edit control "Name".
  2. Press SPACE or ENTER.
  3. The text becomes editable.
    Caption of the control in edit mode
  4. Add an asterisk at the end of the text.
  5. Select this star.
  6. On the "Text" tab, in the "Font" group:
    Font options
    • Click Exhibitor to apply superscript formatting.
    • Change the text color to red with the Change the color button.
  7. Exit the edit mode (Esc).
  8. The red asterisk appears in the control caption.
Previous LessonTable of contentsNext Lesson
Minimum version required
  • Version 28
Comments
Click [Add] to post a comment

Last update: 11/16/2023

Send a report | Local help