4D v16.3

Description of label editor

Home

 
4D v16.3
Description of label editor

Description of label editor  


 

 

4D’s Label editor provides a convenient way to print a wide variety of labels. With it, you can do the following:

  • Design labels for mailings, file folders and file cards, and for many other needs,
  • Create and insert decorative items in label templates,
  • Specify the font, font size, and style to be used for the labels,
  • Specify the number of labels across and down on each page,
  • Specify the how many labels to print per record,
  • Specify the label page margins,
  • Designate a method to execute when printing each label or record,
  • Create a preview and print the labels.

Labels can also be created using the Form editor. Use the Form editor to design specialized labels that include variables or take advantage of the drawing tools available in the Form editor. For more information about using the Form editor to create labels, refer to Creating labels.

You use the Label editor to create, format, and print labels. The Label editor contains settings for designing labels and positioning the labels on label paper. For example, when producing mailing labels, you might want a label design that includes the person’s first and last name on the first line, the street address on the second line, and so on. As part of the design, the Label editor enables you to specify the number of labels on the page and the margins of the label paper so that the label text is centered within the labels.
When you create a satisfactory label design, you can save it to disk so that you can reuse it. 

To open the Label editor:

  • In the Design environment, choose Labels... from the Tools menu or from the menu associated with the “Tools” button in the 4D tool bar.
    OR
  • In the Application environment, use the PRINT LABEL command.

The Label editor includes a button bar and consists of two pages, the Label page and the Layout page, each identified by a button at the top of the dialog box. You use the Label page to specify the contents of the label and the Layout page to define the size and position of the labels on the page.

The Label page contains several areas with settings for designing and formatting labels.

It contains the following elements:

  • List of Fields area: Displays the names of the fields in the current table in a hierarchical list. If this table is related to other tables, the foreign key fields have a plus sign (on Windows) or an arrow (on Macintosh). You can display fields from the related table by expanding the related fields. The fields in the related table are indented.
    To use a field from this list in the label template, you just drag it onto the label preview area to the right of the list.
    Notes:
    • Only tables and fields which are visible appear in the Label editor. For information about making tables and fields invisible, refer to the “Invisible” paragraph in Table properties and Field properties.
    • Object type fields are not supported by the Label editor.

    The search area allows you to narrow the list of fields displayed to those containing the entered string:

  • Label preview area: You use this area to design your label zone by placing and positioning all the items that you want to include in your label. The white rectangle represents a single label (its size is configured on the "Layout" page). You can drag fields onto the label.
    • You can also concatenate two fields by dropping the second field onto the first one. They are automatically separated by a space. If you hold down the Shift key, they are separated by a carriage return. This lets you create, for example, address labels using several overlapping fields (Address1, Address2, etc.), without producing a blank row when an address requires only one field.
    • You can drag and drop picture files as well as label files (".4lbp" files only) from the desktop of the operating system.
    • Fields and text inserted in the area can be modified. To do this, you can simply double-click on the contents in order to switch to editing mode. More particularly, this allows you to remove or modify concatenated items:
    • You can apply a format to a field using the String command in the area, for example:

  • Zoom: You can zoom in your label design by dragging the resize cursor at the bottom right of the window:
  • Form to use drop-down list: Allows you to define a table form as a label template. The form chosen must be specially adapted to the creation of labels.
    In this case, the label editor is partially disabled: only functions of the "Layout" screen can be used — to allow you to configure the page based on the form. The image of the form selected is displayed in the label preview area.
    When you use a form, 4D executes any form or object methods associated with it. Refer to Using the Label editor for more information about creating labels using forms. When using this option, you can also designate a project method to execute for each record or label and then assignate variables (see Printing labels using forms and methods (example) paragraphe below).
    If you want to create your labels using the editor itself, you need to choose the No Form option.
    Notes:
    • You can restrict the forms listed in this menu by means of a specific JSON file (see Controlling available forms and methods).
    • If the database does not contain any table forms, this menu is not displayed.

The graphic area of the editor includes both a tool bar and a context menu that you can use to design your label template.

The left-hand side of the tool bar includes commands for selecting and inserting objects. You can also access these tools by means of the Tool> command in the area's context menu.

Selection tool. Click on a single object or draw a selection box around several objects. For a selection of non-adjacent objects, hold down Shift and click on each object you want to select.
Line creation tool.
Rectangle/rounded rectangle creation tool.
Circle creation tool.
Text insertion tool. Draw a rectangle and enter text inside it. You can edit any text area, including those containing field references, by double-clicking it.

There are shortcuts available to move or resize objects more precisely using the keyboard arrow keys:

  • Keyboard arrow keys move the selection of objects 1 pixel at a time.
  • Shift + arrow keys move the selection of objects 10 pixels at a time.
  • Ctrl + arrow keys enlarge or reduce the selection of objects by 1 pixel.
  • Ctrl + Maj + arrow keys enlarge or reduce the selection of objects by 10 pixels.

The right-hand side of the tool bar contains commands used to modify items of the label template:

Fill Color (all color icons display the selected color)
Line Color
Lineweight
Font menu. Sets the font and its size, as well as the text style, color and alignment for the block(s) of selected text.
Alignment and distribution tools. Two or more objects must be selected for the alignment options to be available. "Distributing" objects means automatically setting the horizontal or vertical intervals between at least three objects, so that they are identical. The resulting interval is an average of all those existing in the selection. 
Object level. Moves objects to the front or back, or moves one or more objects up or down one level.

The Layout page contains controls for printing labels based on the requirements of the printer you selected in the Print Manager (Chooser on Macintosh), so that it can format the page accurately.

  • Labels Order drop-down list: Specifies whether labels should be printed in the direction of the rows or the columns.
  • Rows and Columns areas: Set the number of labels to be printed by "row" and by "column" on each sheet. These settings determine the label size when the "Automatic resizing" option is enabled.
  • Labels per record area: Sets the number of copies to print for each label (copies are printed consecutively).
  • Print Setup button: Sets the format of the page on which the sheet of labels will be printed. When you click this button, the setup dialog box for the printer selected in your system appears.
    By default, the sheet of labels is generated based on an A4 page in portrait mode.
    Note: The sheet created by the editor is based on the logical page of the printer, i.e. the physical page (for instance, an A4 page) less the margins that cannot be used on each side of the sheet. The physical margins of the page are shown by blue lines in the preview area.
  • Unit drop-down list: Changes the units in which you specify your label and label page measurements. You can use points, millimeters, centimeters, or inches.
  • Automatic resizing option: Means that 4D automatically calculates the size of the labels (i.e. the Width and Height parameters) according to the values set in all the other parameters. When this option is checked, the label size is adjusted each time you modify a page parameter. The Width and Height parameters can no longer be set manually.
  • Width and Height areas: Sets the height and width of each label manually. They cannot be edited when the Automatic resizing option is checked (see above). 
  • Margins (Top, Right, Left, Bottom): Sets the margins of your sheet. These margins are symbolized by blue lines in the preview area.
    Clicking on Use printer margins replicates, in the preview area, the margin information provided by the selected printer (these values can be modified).
  • Gaps: Set the amount of vertical and/or horizontal space between label rows and columns.
  • Method: Lets you trigger a specific method that will be run at print time. For example, you can execute a method that posts the date and time that each label was printed. This feature is also useful when you print labels using a dedicated table form (see "Form to use" in the Label Page paragraph above), in which case you can fill variables from a method.
    To be eligible for label processing, a project method must comply with the following settings:
    • it must be "allowed" for the database (allowed methods depend on Database settings and the SET ALLOWED METHODS command), otherwise it will not be displayed in the Apply menu.
    • it must have the "Shared by components and host database" option.

    For an example of this feature, please refer to the Printing labels using forms and methods (example) paragraph below.

    Note: For advanced needs, you can restrict the list of methods available using a specific json file, see Controlling available forms and methods below. 
    The For each: Record or Label radio buttons are used to specify whether to run the method once per label or once per record. This control has meaning only if you are printing more than one copy of each label and you are also executing a method at print time.
  • Layout preview area: Provides a reduced view of how an entire page of labels will look, based on the dimensions you enter in the Label editor. The page preview also reflects the paper size selected in the Print Setup dialog box. You can also use this area to designate the first label on the page to be printed (this option only affects the first sheet in the case of multi-page printing). This can be useful, for example, when you want to print on a sheet of adhesive labels, part of which has already been used. You can also select the first label on the page to be printed by clicking on it:

You can use dedicated table forms and project methods to print labels with calculated variables. This simple example shows how to configure the different elements:

  1. In a dedicated table form, add your label field(s) and variable(s).
    Here, in a table form named "label", we added the myVar variable:
  2. Create a setMyVar project method with the following code:
     C_LONGINT(myVar)
     myVar:=myVar+1
  3. Set the project method as "Shared by components and host database":
  4. Before displaying the Label editor, make sure the project method is allowed by executing this code:
     ARRAY TEXT($methods;1)
     $methods{1}:="setMyVar"
     SET ALLOWED METHODS($methods)
  5. Open the Label editor and use your form:
  6. In the Layout page, select the method:
  7. Then you can print your labels:

The Label editor includes an advanced feature allowing you to restrict which project forms and methods (within "allowed" methods) can be selected in the dialog box:

  • in the Form to use pop-up menu on the "Label" page and/or
  • in the Apply (method) pop-up menu on the "Layout" page.

You just need to add a JSON file to the project folder.

To define forms and/or methods that can be selected in the label design:

  1. Create a JSON file named labels.json and put it in the Resources folder located in the database folder.
  2. In this file, add the names of forms and/or project methods that you want to be able to select in the Label editor menus.

The contents of the labels.json file should be similar to this:

[ 
    {"tableId":2,"forms":[],"methods":["myMethod1","myMethod2"]},
    {"tableId":1,"forms":["Sample Label 1","Sample Label 2"],"methods":[]}
]

If no labels.json file has been defined, then no filtering is applied.

Two buttons in the tool bar allow you to preview and print the label page:

The Preview button displays the first page of labels with dotted lines outlining each label.



See also 

Managing label files

 
PROPERTIES 

Product: 4D
Theme: Label editor (64-bit)

 
HISTORY 

 
ARTICLE USAGE

4D Design Reference ( 4D v16)
4D Design Reference ( 4D v16.1)
4D Design Reference ( 4D v16.3)