Component Names, Naming Conventions

When you add a component to a form, WinStudio automatically assigns a name to the component based on the type of component it is, appended with a number. For example, WinStudio would automatically name a new Edit component edit1. A second Edit component then would be named edit2 (assuming you have not already renamed edit1).

Recommendation: Rename components after adding them.

Remarque: We recommend that you use component names that contain only alphanumeric characters and the underscore (_) character.. Alphanumeric characters include the letters a-z, either upper case or lower case, and the numerals 0-9.

We recommend that you rename components as soon as you add them to a form. This makes it easier to identify what each component is when looking at the list of components. As a convention, we recommend that you use a descriptive name (that is, a name that identifies what the field is used for, such as "CustomerName") and add a prefix for the component type.

So, for instance, as soon as we create the edit1 component, we might want to change the name to CustomerNameEdit. Notice that we kept the "edit" as part of that name, so that we can easily identify what the component type is. The "CustomerName" part lets us know that this is to be used as a field for customer names.

The reason this can be valuable is that on many forms, particularly mulitview forms, you can often have two components that display the same exact information. It is not unusual to have a Customer Name edit field on the Detail View and also have a Customer Name column in the Grid View. So, by naming the former component CustomerNameEdit and the latter one CustomerNameGridCol, you can easily tell which is which when looking at a list of components (as you often must do in Design Mode).

Recommendation: Use default names as part of the component name.

These are the default naming conventions that WinStudio uses for each component type:

Component Type Default Naming Convention Component Type Default Naming Convention
Browser webBrowser Group box groupBox
Button button Hyperlink button hyperlinkButton
Chart chart List box list
Check box checkBox Menu item menuItem
Combo box comboBox Multi-line edit field multiLineEdit
DataView dataView Notebook notebook
Date combo box dateCombo Notebook tab notebookTab
Diagram diagram Radio button radioButton
Drop list field dropList Static field static
Edit field edit Toolbar button toolBarButton
Form page formPage Tree tree
Gauge gauge User control userControl
Grid grid Vertical grid verticalGrid
Grid column gridCol Vertical grid element verticalGridElement
Rubriques liées