Beruflich Dokumente
Kultur Dokumente
Upgrade
Windows®/Mac OS®
4D®
© 1985-2010 4D SAS / 4D, Inc. All Rights Reserved.
4D v12 - Upgrade
Windows® and Mac OS® Versions
Copyright© 1985 - 2010 4D SAS / 4D, Inc.
All Rights Reserved.
The software described in this manual is governed by the grant of license provided in this package. The soft-
ware and the manual are copyrighted and may not be reproduced in whole or in part except for the personal
licensee’s use and solely in accordance with the contractual terms. This includes copying the electronic
media, archiving, or using the software in any manner other than that provided for in the Software license
Agreement.
4D, 4D Draw, 4D Write, 4D View, 4th Dimension®, 4D Server and the 4D logos are registered trademarks of
4D SAS.
Microsoft, Windows, Windows XP, Windows Vista and Windows 7 are registered trademarks of Microsoft
Corporation.
Apple, Macintosh, iMac, Mac OS and QuickTime are trademarks or registered trademarks of Apple Computer
Inc.
Mac2Win Software Copyright © 1990-2010 is a product of Altura Software, Inc.
ICU Copyright © 1995-2010 International Business Machines Corporation and others. All rights reserved.
ACROBAT © Copyright 1987-2010, Secret Commercial Adobe Systems Inc. All rights reserved. ACROBAT is a
registered trademark of Adobe Systems Inc.
This product includes software developed by the Apache Software Foundation (http://www.apache.org/). 4D
includes cryptographic software written by Eric Young (eay@cryptsoft.com)
4D includes software written by Tim Hudson (tjh@cryptsoft.com).
Spellchecker © Copyright SYNAPSE Développement, Toulouse, France, 1994-2010.
All other referenced trade names are trademarks, registered trademarks, or copyrights of their respective
holders.
Chapter 1 Welcome . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Conversion of earlier databases . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Databases in versions 6.x, 2003.x and 2004.x . . . . . . . . . . . . . 14
Databases in version 11 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Updating the Macros.xml file . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Minimum configuration. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Phasing out obsolete functions . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Display of named platform appearances. . . . . . . . . . . . . . . . . . 18
Contextual mode of Web server . . . . . . . . . . . . . . . . . . . . . . . . 18
4D v12 Upgrade 3
Contents
Structure editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Dim Others . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Move to Front . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
Optimizing searches in the Design environment . . . . . . . . . . . . . . 43
Search dialog box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Examples of searches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
Replace and rename . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
Searching for unused elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
Find Unused Methods and Global Variables . . . . . . . . . . . . . . . 54
Find Unused Local Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
New code editor. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Text entry assistance. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Browsing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
Display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
Executing PHP scripts in 4D . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
Using another PHP interpreter or another php.ini file . . . . . . . 64
PHP modules. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
Executing a PHP script . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
Recover by record headers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
What is recovery by header markers?. . . . . . . . . . . . . . . . . . . . . 66
Recovery procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
4 4D v12 Upgrade
Contents
Rich text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
Rich text management properties . . . . . . . . . . . . . . . . . . . . . . . 95
Processing rich text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
New properties for fields and variables . . . . . . . . . . . . . . . . . . . . . 99
Objects not enterable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
Multiline objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
Selection always visible . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
List boxes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
Hierarchical list boxes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
Printing list boxes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
Access to data of added SELECT columns . . . . . . . . . . . . . . . . 117
Toolbar button (Mac OS) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
Toolbar property . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
On Mac toolbar button form event. . . . . . . . . . . . . . . . . . . . . 119
4D v12 Upgrade 5
Contents
6 4D v12 Upgrade
Contents
4D v12 Upgrade 7
Contents
8 4D v12 Upgrade
Contents
SearchPicker . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267
SearchPicker SET HELP TEXT . . . . . . . . . . . . . . . . . . . . . . . . 267
TimePicker . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267
TimePicker APPLY DEFAULT VALUES . . . . . . . . . . . . . . . . . 268
TimePicker RESET DEFAULT VALUES . . . . . . . . . . . . . . . . . 268
TimePicker SET DEFAULT LABEL AM . . . . . . . . . . . . . . . . . 269
TimePicker SET DEFAULT LABEL PM. . . . . . . . . . . . . . . . . . 269
TimePicker SET DEFAULT MAX TIME . . . . . . . . . . . . . . . . . 269
TimePicker SET DEFAULT MIN TIME . . . . . . . . . . . . . . . . . 270
TimePicker SET DEFAULT STEP . . . . . . . . . . . . . . . . . . . . . . 270
TimePicker SET LABEL AM . . . . . . . . . . . . . . . . . . . . . . . . . . 271
TimePicker SET LABEL PM . . . . . . . . . . . . . . . . . . . . . . . . . . 271
TimePicker SET MAX TIME . . . . . . . . . . . . . . . . . . . . . . . . . 271
TimePicker SET MIN TIME . . . . . . . . . . . . . . . . . . . . . . . . . . 272
TimePicker SET STEP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272
4D SVG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
SVG_SET_CLASS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
SVG_SET_CLIP_PATH . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
SVG_SET_FILL_RULE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275
SVG_SET_SHAPE_RENDERING . . . . . . . . . . . . . . . . . . . . . . 276
SVG_SET_STROKE_DASHARRAY . . . . . . . . . . . . . . . . . . . . . 276
SVG_SET_STROKE_MITERLIMIT . . . . . . . . . . . . . . . . . . . . . 277
Colors and Gradients. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278
SVG_Color_RGB_from_CMYK . . . . . . . . . . . . . . . . . . . . . . . 278
SVG_Color_RGB_from_HLS . . . . . . . . . . . . . . . . . . . . . . . . . 279
SVG_GET_COLORS_ARRAY . . . . . . . . . . . . . . . . . . . . . . . . . 279
Drawing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280
SVG_Add_object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280
Structure and Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280
SVG_Define_clip_path . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280
SVG_Define_pattern . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281
SVG_Define_style . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283
SVG_DELETE_OBJECT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285
SVG_Get_default_encoding . . . . . . . . . . . . . . . . . . . . . . . . . 285
SVG_SET_DEFAULT_ENCODING . . . . . . . . . . . . . . . . . . . . 285
SVG_SET_PATTERN_CONTENT_UNITS. . . . . . . . . . . . . . . . 286
SVG_SET_PATTERN_UNITS . . . . . . . . . . . . . . . . . . . . . . . . . 286
Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286
SVG_APPEND_TEXT_TO_TEXTAREA . . . . . . . . . . . . . . . . . 286
SVG_Get_text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287
SVG_SET_TEXT_KERNING . . . . . . . . . . . . . . . . . . . . . . . . . . 288
SVG_SET_TEXT_LETTER_SPACING . . . . . . . . . . . . . . . . . . . 289
SVG_SET_TEXT_RENDERING . . . . . . . . . . . . . . . . . . . . . . . 290
SVG_SET_TEXT_WRITING_MODE . . . . . . . . . . . . . . . . . . . 290
4D v12 Upgrade 9
Contents
SVG_SET_TEXTAREA_TEXT . . . . . . . . . . . . . . . . . . . . . . . . . 291
SVG_New_textArea . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292
SVG_SET_FONT_FAMILY . . . . . . . . . . . . . . . . . . . . . . . . . . . 292
Utilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292
SVG_ABOUT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292
SVGTool_SET_VIEWER_CALLBACK . . . . . . . . . . . . . . . . . . . 293
SVG_References_array . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293
10 4D v12 Upgrade
Contents
4D v12 Upgrade 11
Contents
12 4D v12 Upgrade
1 Welcome
New form objects and widgets accelerate the setting up of modern and
sophisticated interfaces: steppers, texts with styles, date or time
selectors (datepicker), textual search area and also hierarchical list boxes
are part of these new features. Subforms benefit from many
improvements more particularly to make them easier to use as
components. The new preconfigured object library provides fast access
to these functionalities.
4D v12 Upgrade 13
Chapter 1 Welcome
Development Workshop
4D Server Administration
4D Server The 64-bit version of 4D Server v12 is being finalized. A beta version is
currently available for download from our Web site
(http://www.4d.com/).
Note: You can convert any interpreted structure file. The file can contain
compiled code; in this case, it is necessary to compile the database
again after conversion.
Databases in Structural changes made at the 4D database engine level require in-
versions 6.x, 2003.x depth conversion of both the structure and data of earlier databases
and 2004.x using a specific wizard when converting to versions 11 and 12. As a
precaution, this wizard makes a copy of the original database before
converting it so you can revert to it any time.
14 4D v12 Upgrade
Conversion of earlier databases
We recommend that you check the integrity of the database using the
4D Tools utility (compacting, verifying and, if necessary, repairing the
database) before conversion. Use the 4D Tools version that corresponds
to your original database.
Click on the Convert database button to start the standard process for
converting the structure and data files.
For more information about this dialog box and the conversion pro-
cess, refer to the “Converting Databases from Previous Versions” para-
graph in the 4D Design Reference manual.
Any older or obsolete mechanisms that are no longer supported are
removed or replaced during conversion. For more information, refer to
the 4D v11 SQL Update manual. For a detailed description of all the
modifications, refer to the document Conversion to 4D v11 SQL avail-
able for download here: http://doc.4d.com/home.en.html
4D v12 Upgrade 15
Chapter 1 Welcome
Databases in version A database from version 11 gets converted directly when you open the
11 structure file with 4D v12. Two successive warnings let you know that
the files are being converted and that you can no longer open them
with an earlier version:
However, you can still open the converted data file in version 11 by
explicitly authorizing this on the version 11 side. This is done using
the Allow opening v12 data file preference found on the
“Database/Data Management” page of the Preferences (beginning with
4D v11 SQL r6 only):
Use this option with care in the case where specific attributes of
version 12 have been applied to database tables (risk of altering data).
16 4D v12 Upgrade
Minimum configuration
Updating the The "Macros.xml" file lets you use macro commands in the Method
Macros.xml file editor (see the Design Reference manual). It is located in the user
preferences folder:
Windows XP: C:\Documents and Settings\UserName\Application
Data\4D\Macros v2\
Windows Vista/Windows 7: C:\Users\UserName\AppData\Roam-
ing\4D\Macros v2\
Macintosh: {Startup disk}:Users:UserName:Library:Prefer-
ences:4D:Macros v2
Minimum configuration
4D version 12 product line applications require the following
minimum configurations:
Windows Mac OS
Processor Pentium IV processor Intel® processor
System Windows Vista, Windows XP, Mac OS version 10.5 and higher
Windows 7
RAM memory 1 GB (2 GB recommended)
Screen resolution 1280 * 1024 pixels
4D v12 Upgrade 17
Chapter 1 Welcome
Display of named Up to 4D version 2003, you can assign a specific platform appearance
platform to the database, forms, or objects. The options available are: Mac OS 7,
appearances Windows 3.11/NT 3.51, Windows 95/95/2000/NT4, Mac OS9 and Mac
Theme.
Henceforth, 4D v12 is the last version that displays these named
appearances in converted databases. In future versions, 4D will
automatically assign the System appearance to any objects with this
type of attribute.
Contextual mode of 4D v12 is the last version to support the Web server in contextual
Web server mode. This mode and the mechanisms associated with it will no longer
work in the next major version.
18 4D v12 Upgrade
2 Architecture and
Database
New option for handling style tags in Alpha and Text fields
4D v12 Upgrade 19
Chapter 2 Architecture and Database
Note You can access the field properties related to UUIDs using the 4D SQL
commands (see the “Support of UUID fields” paragraph on page 307).
New UUID 4D v12 has two new options added to the field inspector to configure
properties for fields UUID support:
Management options
for UUID property
You must select the Alpha field type to access these options.
20 4D v12 Upgrade
Using Universally Unique Identifiers (UUIDs)
UUID format The UUID format property indicates that the field stores the UUID
identifiers. The stored data must conform to the UUID format
(combination of 32 letters (A-F, a-f) and numbers (0-9)). To do this, you
can use the Auto UUID property, the new Generate UUID command, or
any custom algorithm.
If you try to store a string that does not comply with the UUID format
in this field, 4D reformats it automatically: it converts the codes of the
first 16 characters of the string into hexadecimal format and stores the
result. The rest of the string is truncated. If the string has less than 16
characters, the missing characters are filled by spaces ("20" in
hexadecimal). This mechanism is also applied to the contents of
existing non-Alpha fields that are transformed into UUID fields: when
loading the records, the values are reformatted and then stored once
again.
Note that this mechanism only allows you to obtain correctly
formatted values. It does not guarantee the uniqueness of the values
stored. It is up to you to generate valid UUIDs using the appropriate
tools ("Auto UUID" option, Generate UUID command or a custom
algorithm).
Fields with the UUID format property can be displayed in forms and
remain enterable. Their contents appear in upper-case characters. You
must pass through a variable if you want to display lower-case
characters.
Notes - Fields with the UUID format cannot be associated with keyword
indexes nor with choice lists.
- You can create a relation between two fields that both have the UUID
format but you cannot link a standard Alpha field to a field that has
the UUID format.
Auto UUID This option is only active when you select the UUID format property.
You can use the Auto UUID property to generate a UUID number
automatically in the field each time a record is created.
Note When data is imported, even with this property selected, 4D does not
generate a new number but uses the imported values (and transforms
them when necessary if the format is not valid). However, if the value
of the imported field is empty, a UUID is automatically generated.
4D v12 Upgrade 21
Chapter 2 Architecture and Database
When you select this option, queries and sorts carried out in the data
stored in the field do not take any style tags into account.
Style tags are stored with the data. For example, if you write "week end"
in a Text field, 4D stores "week <SPAN STYLE = "color:
#D81E05">end</SPAN>". This operation is transparent for the user at
the form level. However, for queries and sorts, a specific setting is
necessary for 4D to ignore the style tags. For the word "week end", the
query can find it only if you have selected the Queries and sorts on
text without tags option for the field in the Structure editor.
Note With this option, a query for thevalue among the data of thefield is the
same as executing this statement within 4D: QUERY BY
FORMULA(OBJECT Get plain text(thefield)="thevalue").
22 4D v12 Upgrade
Replicating data
Replicating data
4D v12 has new mechanisms based on SQL that you can use to set up
an advanced data replication system.
Enabling of replication
For more information about this option as well as about the record
replication mechanisms, refer to the “Replication via SQL” paragraph
on page 295.
Setting the primary In 4D v12, you can manage the primary key of a table directly in the
key Structure editor.
You create and remove primary keys directly using the context menu
of the Structure editor.
X To create a primary key:
1 Select the field(s) that make up the table’s primary key.
4D v12 Upgrade 23
Chapter 2 Architecture and Database
2 Right click and choose Create primary key in the context menu:
The field(s) belonging to the primary key must not contain any
duplicated values. If any duplicated values already exist in the table
records, a warning dialog box appears to indicate this.
Note The column(s) belonging to the primary key do not accept NULL
values.
24 4D v12 Upgrade
Importing and exporting data
Selection of In the import and export dialog boxes of 4D v12, you can now specify
character set the character set to use for data exchanges in certain formats:
Menu to select
character set
This menu is available for Text, SYLK and XML (export) file formats. It
contains a standard list of character sets as specified by the IANA (for
more information, refer to: http://www.iana.org/assignments/character-
sets).
Note The Character Set menu is locked to the "IBM437" character set for the
DIFF and DBF formats and this menu is not available for the 4D
format.
When exporting, you use this menu to specify the encoding for the
exported data.
When importing, you use this menu to specify the encoding of the
imported data. This menu is disabled if the header of the export files
includes a BOM (see the next section) because the encoding of the
imported data is automatically predefined in this case.
4D v12 Upgrade 25
Chapter 2 Architecture and Database
The default encoding for import and export operations is UTF-8 or the
character set specified by the USE CHARACTER SET command (if it has
been executed). Note that selecting an encoding in the import or
export dialog box does not modify the current character set of the
application.
Note The Destination Platform menu, used to set the end of record
character(s), includes new options: Automatic (end of record value set
according to export platform), Unix (end of record = line break) and
Custom (displays the delimiters page).
Integrating the byte The Generate BOM option now appears on the "Header" tab of the
order mark standard data export dialog box:
This option is only available when exporting data in text format (Text
or Fixed Length Text).
When you select the Generate BOM option, 4D inserts a Byte Order
Mark (BOM) in the export file header.
26 4D v12 Upgrade
Components installed in the 4D application
New XML export New options are available on the "XML" tab of the export dialog box:
options
4D v12 Upgrade 27
Chapter 2 Architecture and Database
Choosing a location In 4D v12, you can install the Components folder in two different
for the Components locations:
folder
At the 4D executable application level.
- Windows: next to the .exe file
- Mac OS: at the first level of the Contents folder, inside the application
package.
Here the components are available in every database that the
application opens.
At the database structure file level (location used in previous 4D
versions).
Here the components are only available for this particular database.
The choice of the location depends on how you want to use the
component.
Note In 4D v12, a new property lets you publish the project form of a
component as a subform in the host database. For more information
about this point, refer to the “Subforms in components” paragraph on
page 78.
28 4D v12 Upgrade
3 Development Workshop
Note that the new features related to forms and form objects are
covered in a specific section, chapter 4, “Forms and Objects“, page 71.
Reorganization of Preferences
The management of Preferences in 4D v12 is reorganized so as to
separate parameters common to all 4D applications ("user preferences")
from those specific to each database ("database settings"). New options
are also available.
Preferences and In 4D v12, there are two separate dialog boxes to configure two sets of
Settings options with different scopes: the "User Preferences" dialog box and
the "Database Settings" dialog box.
4D v12 Upgrade 29
Chapter 3 Development Workshop
Note This manual only describes new options or options whose operation is
modified. For more information about existing options, refer to the
Design Reference manual.
User preferences You can access the Preferences dialog box from the Edit > Preferences...
menu (Windows) or the 4D Application menu (Mac OS):
30 4D v12 Upgrade
Reorganization of Preferences
4D user
preferences
4D v12 Upgrade 31
Chapter 3 Development Workshop
Database settings You can access the Database Settings dialog box via the Design >
Database Settings... menu option or the corresponding button on the
4D toolbar:
For security reasons, database settings can only be accessed via this
dialog box.
32 4D v12 Upgrade
Reorganization of Preferences
Customizing In the Preferences and Settings dialog boxes, parameters whose values
parameters and have been modified appear in bold:
"Factory settings"
To reset the parameters to their default values and remove the bold
style indicating that they have been customized, click on the new
Factory settings button:
Resetting parameters
This button resets all the parameters of the current page. It becomes
active when at least one parameter has been modified on the current
page.
Interaction with the You set certain settings (such as the definition of the IP number for the
SET DATABASE PHP interpreter) either in the Database Settings dialog box, or by using
PARAMETER the SET DATABASE PARAMETER command.
command
These two ways function in a complementary manner:
Parameters set in the Database Settings dialog box are always used by
default for all the machines,
Parameters modified using the SET DATABASE PARAMETER command
only apply to the machine that executed the command and during the
current session. They do not modify the Database Settings dialog box
parameters.
4D v12 Upgrade 33
Chapter 3 Development Workshop
New preferences 4D v12 provides new user preferences to customize your work
environment.
Style of SQL syntax Syntax analysis in the new code editor of 4D v12 differentiates
elements between SQL elements and those of 4D (see the “New code editor”
paragraph on page 55). It is now possible to attribute a custom style to
each element type using the "Styles" tab on the "Methods" page in the
Preferences:
34 4D v12 Upgrade
Reorganization of Preferences
Method editor and The "Options" tab of the "Methods" page of the Preferences has new
debugger options options related to the Method editor and debugger:
4D v12 Upgrade 35
Chapter 3 Development Workshop
"Rectangle" appearance
If you deselect this option, only the yellow arrow is shown (as in
previous versions of 4D).
Suggestions The autocomplete mechanisms in the Method editor are refined and
extended in 4D v12 (see the “Autocomplete” paragraph on page 56).
The "Suggestions" area lets you configure this feature to adapt it to
your own work habits.
Compatibility note The "Allow Type-Ahead" option, found in previous versions of 4D, is
replaced by these new options.
36 4D v12 Upgrade
Reorganization of Preferences
You can disable this functioning for certain elements of the language
by deselecting their corresponding option.
Validation of a suggestion for:
This option sets the entry context that allows the Method editor to
validate automatically the current suggestion displayed in the
autocomplete window.
Tab and delimiters: When this option is selected, you can validate
the current selection with the Tab key or any delimiter that is
relevant to the context. For example, if you enter "ALE" and then
"(", 4D automatically writes "ALERT(" in the editor. Here is the list of
delimiters that are taken into account:
(;:=<[{
This works the same way as in the previous 4D version.
Tab only: When this option is selected, you can only use the Tab
key to insert the current suggestion. This can be used more
particularly to facilitate the entry of delimiter characters in element
names, such as ${1}.
Note You can double-click in the window or press the Carriage return key to
validate a suggestion.
Colors Use these options to configure the different colors used in the Method
editor interface.
Line where the cursor is (active window) / Line where the cursor is
(inactive window): Background color of line containing the cursor.
Highlight of the words found: Highlight color of words found in a
search.
Highlight of the parentheses: Highlight color of corresponding
parentheses (used when pairs of parentheses are signaled by
highlighting, see the “Method editor and debugger options”
paragraph on page 35).
4D v12 Upgrade 37
Chapter 3 Development Workshop
This page lists all the shortcuts used in the 4D Design environment
(except for standard "system" shortcuts, such as Ctrl+C/Command+C for
the Copy command). To modify a shortcut, you can select/deselect the
item to modify (Shift, Alt or letter key) in the list. You can also double-
click on a shortcut to configure it using a specific dialog box. Note that
each shortcut implicitly includes the Ctrl (Windows) or Command
(Mac OS) key.
Note This list is based on the 4DShortcutsv12.xml file located in the [4D
Extensions] subfolder. If you customize the list in the dialog box, this
file is duplicated in the user Preferences folder and is used instead of
the standard file. Hence, each time 4D is updated your keyboard
shortcut preferences remain.
38 4D v12 Upgrade
Reorganization of Preferences
New database
settings
PHP In 4D v12, you can execute PHP scripts directly by configuring the PHP
page of the Database Settings (see the “Executing PHP scripts in 4D”
paragraph on page 62):
Note that the HTTP address must be on the same machine as 4D.
External interpreter
4D v12 Upgrade 39
Chapter 3 Development Workshop
PHP options
Note Under Mac OS, all child processes share the same port.
Under Windows, each child process uses a specific port number. The
first number is the one set for the PHP interpreter; the other child
processes increment this number. For example, if the default port is
8002 and you launch 5 child processes, they will use ports 8002 to
8006.
Note In this dialog box, the parameters are specified by default for all
connected machines and all sessions. You can also modify and read
them separately for each machine and each session using the SET
DATABASE PARAMETER, Get database parameter commands. The
parameters modified by the SET DATABASE PARAMETER command have
priority for the current session.
40 4D v12 Upgrade
Structure editor
64-bit compilation You can compile 4D v12 applications for 32-bit and 64-bit processors.
You enable this on the "Compiler" page of the Database Settings by
selecting or deselecting the new Also compile for 64-bit processors
option:
New option
Structure editor
The Structure editor has new functions related to display management.
Dim Others You can now dim tables and relations that are not selected in the
Structure editor. In previous 4D versions, tables could only be dimmed
by folder.
The new Dim Others function dims any table and/or relation not
selected or not connected to the selected elements in the editor
window. It is available:
in the folder management menu of the editor,
4D v12 Upgrade 41
Chapter 3 Development Workshop
Highlight All When elements are dimmed using Dim Others or a folder management
menu command, the new Highlight All command redisplays all the
contents of the editor. This command is in the context menu of the
structure editor.
Move to Front When a group of several tables are superimposed in the Structure
editor, it may be difficult to display one of the tables of the group.
In this case, you can right click on the top table to display the Move to
Front submenu, which lists the names of all the tables stacked under
the first one.
42 4D v12 Upgrade
Optimizing searches in the Design environment
You can then select the table you want to move to the front from this
list:
4D v12 Upgrade 43
Chapter 3 Development Workshop
Search dialog box The search dialog box appears when you select the Edit > Find in
Design menu command. In 4D v12, the options provided in this dialog
box have been modified:
Definition of a search You can specify the type of element to look for using the Find menu.
The following choices are available:
44 4D v12 Upgrade
Optimizing searches in the Design environment
Comment: This search is basically the same as the previous one but it is
restricted to the contents of comments (lines beginning with //). For
example, you can search for any comments containing the string "To
be verified".
Note The end result of both types of searches depends on how the search
mode (which) menu is set (see the “Search mode” paragraph on
page 46).
4D v12 Upgrade 45
Chapter 3 Development Workshop
Anything: This option searches among all the objects in the Design
environment. Only the modification date filter is available. Use this
option, for example, to search for "all objects modified today".
Search mode The search mode menu (i.e. which, that is or whose name, depending
on the type of search) specifies how to search for the value that is
entered. The contents of this menu vary according to the type of
element to search for as selected in the previous menu.
Search options for Text or Comment:
contains: Searches all the text of the Design environment for the
specified string. Search results for "var" can include "myvar",
"variable1" or "aVariable".
contains whole word: Searches all the text of the Design
environment for the string as a whole word. Search results for "var"
only include exact occurrences. They will not include "myvar" but
will include, for example, "var:=10" or "ID+var" because the symbols
: or + are word separators.
starts with / ends with: Searches for the string at the beginning or
end of the word (text search) or at the beginning or end of the
comment line (comment search). In "Text ends with" mode,
searching for "var" will find "myvar".
Search options for Language element: The menu offers standard
options (is exactly, contains, starts with, ends with) similar to the ones
provided in previous 4D versions.
Note that you can use the search wildcard (@) with the is exactly
option (returns all objects of the type specified).
Modification date of the This menu has several new options to let you quickly specify a
parent standard search period:
46 4D v12 Upgrade
Optimizing searches in the Design environment
4D v12 Upgrade 47
Chapter 3 Development Workshop
Search for all references to the "Input" form of the [Customers] table:
Search for calls to any methods whose name starts with "HR_"
48 4D v12 Upgrade
Optimizing searches in the Design environment
Search for the "Designer" keyword in the comments written this week:
4D v12 Upgrade 49
Chapter 3 Development Workshop
Replace and rename Renaming and replacing functions are simplified in 4D v12. There are
now two commands available:
Replace in content, found in the search results window. This command
replaces one character string by another within the listed objects.
Rename, found in the Explorer and the New code editor. This
command renames a project method or variable and propagates its
new name among all its callers.
Replace in content All replacing is now done using the new Replace in content command
that is available in the options menu of the search results window.
When you select this command, a dialog box appears where you enter
the character string that will replace all the occurrences found by the
initial search:
50 4D v12 Upgrade
Optimizing searches in the Design environment
Only the occurrences shown in the list will be replaced and only after
checking the initial search criteria for cases where objects were
modified between the initial search and the replacing operation.
Replacing is done in:
the contents of methods
the properties of form objects
the contents of help messages
the contents of entry filters
the contents of menu items (item text and method calls)
the contents of choice lists
the contents of comments for methods, forms, tables and fields in
the Explorer.
For each object modified, 4D checks whether it is already loaded by
another machine or in another window. In the case of conflict, a
standard dialog box appears indicating that the object is locked. You
can close the object and then try again or cancel its replacement. The
replacing operation will then continue with the other objects in the
list.
4D v12 Upgrade 51
Chapter 3 Development Workshop
52 4D v12 Upgrade
Searching for unused elements
When you select this command, a dialog box appears where you enter
the new name for the object:
This new name must comply with naming rules; otherwise a warning
appears when you validate the dialog box. For example, you cannot
rename a method with a command name such as "Alert".
4D v12 Upgrade 53
Chapter 3 Development Workshop
New commands
Find Unused The Find Unused Methods and Global Variables command looks for
Methods and Global project methods as well as "global" variables (process and interprocess
Variables variables) that are declared but not used. The search results appear in a
standard results window.
54 4D v12 Upgrade
New code editor
Find Unused Local The Find Unused Local Variables command looks for local variables
Variables that are declared but not used. The search results appear in a standard
results window.
The editor in 4D v12 retains most of the characteristics and tools of the
one in 4D v11 SQL as well as bringing in additional functions. This
manual only describes the new features and modifications. For a
description of the basic functions of the editor, refer to the Design
Reference manual of 4D v11 SQL.
Text entry assistance There are several new functions for text entry assistance and code
editing in 4D v12.
4D v12 Upgrade 55
Chapter 3 Development Workshop
Autocomplete Autocomplete features now apply to SQL code and take into account
previously entered parameters, such as the optional "*" parameter. Two
new features are provided:
When the characters you enter correspond to a single possible value, it
appears grayed out (and is inserted if you hit the Tab key):
56 4D v12 Upgrade
New code editor
Changing case You can now automatically modify the case of selected characters
using commands from the Case submenu in the Method menu or the
context menu of the editor:
Entry on several rows You can now write a single statement on several lines by terminating
each line of the statement with a backslash "\" character. 4D will
consider all the lines at once.
For example, both of the following statements are equivalent:
Collapse/Expand Use the new commands in the Method menu to collapse and expand
selection parts of the code.
4D v12 Upgrade 57
Chapter 3 Development Workshop
IME (Windows) Under Windows, the new code editor includes an Input Method Editor
(IME) to facilitate code editing on Japanese or Chinese systems.
Browsing
Goto Definition The new Goto Definition command opens the definition of an object
referenced in the Method editor (method, field, table or form) directly
in a new window. To do this, place the cursor inside the object name
(or select it) and choose Goto Definition... from the Method menu or
from the context menu of the editor:
58 4D v12 Upgrade
New code editor
Go to start or end of Two new commands facilitate browsing among the code structures
block (If...Else...End if, etc.):
Start Of Block: Moves the cursor in front of the opening keyword of
the current structure.
End Of Block: Moves the cursor to just after the closing keyword of the
current structure.
These commands are available in the Method menu or via the context
menu of the editor. You can also use the following key combinations:
Windows: Ctrl + Ç or Ctrl + È
Mac OS: Command + Ç or Command + È
Bookmarks 4D v12 lets you associate bookmarks with certain lines in your
methods. You can then browse quickly within the code by passing
from one bookmark to another using specific commands.
Bookmark
associated with line
A bookmark moves along with its original row if additional rows are
inserted in the method. Bookmarks are saved with the methods.
4D v12 Upgrade 59
Chapter 3 Development Workshop
Toggle: Associates a bookmark with the current line (where the cursor
is located) if it does not already have one or removes the existing
bookmark if it does.
This function is also available using the Toggle Bookmark command of
the editor’s context menu or using the Ctrl+F3 (Windows) or
Command+F3 (Mac OS) keyboard shortcut.
Remove All: Removes all bookmarks from the foreground window.
Search references The Search references... command found in the Method menu or the
context menu of the Method editor, replaces the Search Callers
command found in previous versions of 4D. Search Callers displayed
the list of objects referencing (calling) the submethod selected in a
search results window.
60 4D v12 Upgrade
New code editor
Display New visual marks facilitate the readability and maintenance of the
code.
When you click next to a surrounding character (parentheses or
bracket), it (along with its corresponding start/end character) is framed
by a gray rectangle:
This mark also appears when you type a closing parenthesis or bracket.
Errors are indicated by an icon with a help tip to the left of the editing
area:
When a block of code is collapsed, only the first line is visible and an
expand button automatically appears:
Expand button
If you place the mouse over the expand button, a help tip appears,
displaying the first lines of the hidden code.
A help tip now shows the type of the variables:
You can now display the spaces between words using symbols instead
of "blank space". This function applies to all the code elements
(command names, variables, comments, etc.) and is available via the
View > White Spaces command of the Method menu:
Spaces not displayed
Spaces displayed
The status bar located at the bottom right part of the editor window
displays the position of the cursor at all times:
4D v12 Upgrade 61
Chapter 3 Development Workshop
Change bars
Comments Code comments are now indicated using the double slash character
(//). You can now comment/uncomment a line or block of lines using
the shortcut Ctrl+/ (Windows) or Command+/ (Mac OS).
Note For compatibility, you can still use the ` character to comment a line.
Handling of pictures
62 4D v12 Upgrade
Executing PHP scripts in 4D
LDAP access
This list is not exhaustive. For a complete list of the PHP modules
available by default with 4D, refer to appendix A, “PHP Modules,” page
325. Also, note that it is possible to install additional custom modules
(see the “Installation of additional modules” paragraph on page 331).
Note If the 4D program quits unexpectedly while child PHP processes are
still active, you must delete them manually via the system process
management window.
4D v12 Upgrade 63
Chapter 3 Development Workshop
Note If you launch two 4D applications on the same machine and execute
PHP statements on each of them (via the PHP Execute command, see
below), it is imperative to modify the listening ports of the FastCGI
PHP interpreter so that you use a different one for each application.
Otherwise, PHP statements can unpredictably fail to execute.
Using another PHP You can choose to use a different PHP interpreter than the one
interpreter or provided by 4D. A custom PHP interpreter must respect two
another php.ini file conditions:
It must be compiled in FastCGI,
It must be located on the same machine as 4D.
You can also use a custom php.ini configuration file in order, for
example, to use additional modules. The php.ini file can be used, more
particularly, to declare the location of the PHP extensions.
To do this, place a custom php.ini file in the preferences folder of the
current database ("Preferences" folder located next to the structure file).
4D detects it when the interpreter executes and uses it instead of the
default 4D php.ini file. You must make sure that the contents of the
custom php.ini file are valid.
64 4D v12 Upgrade
Executing PHP scripts in 4D
PHP modules The PHP interpreter provided with 4D v12 contains a selection of
integrated modules, retained in particular according to their
pertinence and relevance.
Executing a PHP To execute a PHP script or function, you must use the new PHP Execute
script command. This command is described in the “PHP Execute” paragraph
on page 182.
4D v12 Upgrade 65
Chapter 3 Development Workshop
New recovery
option
Use this low-level repair option only when the data file is severely
damaged and after all other solutions (restoring from a backup,
standard repair) have proven to be ineffective.
What is recovery by 4D records are variable in size. Hence it is necessary to keep the
header markers? location where they are stored on your disk in a table in order to find
them again. The program therefore accesses the address of the record
via an index and a table of addresses.
66 4D v12 Upgrade
Recover by record headers
If only the records or the indexes are damaged, the standard repair
option is usually sufficient to resolve the problem. However, when the
address table itself is affected, it requires a more sophisticated recovery
since it will be necessary to reconstitute it. To do this, the MSC uses the
marker located in the header of each record. The markers are compared
to a summary of the record, including the bulk of their information,
and from which it is possible to reconstruct the address table.
Note If you have deselected the Records definitively deleted option in the
properties of a table in the database structure, performing a recovery
by header markers may cause records that were previously deleted to
reappear.
Recovery procedure To do a recovery by headers, display the "Repair" page of the MSC and
select the Recover by record headers option, then click on Scan and
repair...
Note This operation requires that you open the database in Maintenance
mode. If not, a warning dialog box informs you that the database will
be closed and reopened in this mode.
4D v12 Upgrade 67
Chapter 3 Development Workshop
Note If all the records and all the tables have been assigned, only the main
area is displayed.
The "Content of the scanned data file" area includes two tables
summarizing the information from the scan of the data file.
The first table lists the information from the data file scan. Each row
shows a group of recoverable records in the data file:
The first column indicates the recovery order for the group of records.
68 4D v12 Upgrade
Recover by record headers
The Recover column lets you indicate for each group whether you
want to recover the records. By default, this option is checked for every
group.
The second table lists the tables that were not assigned, i.e. tables that
could not be associated with any records.
Manual assigning If several groups of records could not be assigned to tables due to a
damaged address table, you can assign them manually.
Next select the table you want to assign to the group in the
"Unassigned tables" table and click on the Assign table button. You can
also assign a table by drag and drop.
The group of records is then associated with the table and it will be
recovered in this table. The names of tables that are assigned manually
appear in black.
4D v12 Upgrade 69
Chapter 3 Development Workshop
Launching the recovery Once you have configured the elements to recover, click on the
Recover button to launch the repair.
Note You can click on the Back button to cancel the procedure and return to
the previous state.
4D creates a new empty data file at the location of the original file to
receive the recovered data. The original file is moved to the folder
named "\Replaced Files (Repairing) date time" whose location was
specified on the "Repair" page of the MSC (database folder by default).
As with all analysis functions of the MSC, the Open log file button
displays a Web page in your browser providing the details of the
operation results. This page lists all the checks or repairs performed
and indicates every error that occurred, if applicable ([OK] is displayed
when the verification is correct). The log file is generated in the Logs
folder of the database. It is created in XML and HTML format and is
named “DatabaseName_Repair_log”.
70 4D v12 Upgrade
4 Forms and Objects
4D v12 offers numerous new features related to forms and the objects
they contain. These new features facilitate and accelerate the
development of your application interfaces.
4D v12 Upgrade 71
Chapter 4 Forms and Objects
New properties You can now associate additional properties, using the Property list, to
subform objects installed in the parent forms:
Variable Name: a variable can now be bound with a subform object. By
default, it is named "Subform", like the object itself. It has a type (see
following paragraph) and can be represented in the form of a standard
variable in the parent form. Its modification triggers form events and
can therefore synchronize the values of the parent form and the
subform:
Use the On Data Change form event to indicate to the subform
container that the variable value was modified in the subform.
Use the new On bound variable change form event to indicate to the
subform (form method of subform) that the variable was modified
in the parent form (see the “Update of subform contents”paragraph
on page 74).
Variable Type: used to set the type for the variable bound with the
subform object. By default, the Alpha type is used. The variable type
determines the nature of the values exchanged between the parent
form and the subform via the bound variable.
You can set the type to "None"; in this case, 4D automatically types the
variable during execution (see the “Dynamic variables” paragraph on
page 255).
Source: named "Source Table" in previous versions of 4D, this property
is now used to select different types of sources:
<None>: choose this type of source to use a project form or a
component form as subform. These subforms can only be used in
page form: for them to work, you must deselect the "List subform"
option.
For a component form to appear in the "Detail Form" list, it must be
published in the component (see the “Publishing a subform
(component)”paragraph on page 79).
Table name: choose this type of source to use table forms (same
behavior as previously in 4D).
72 4D v12 Upgrade
Extension of subform capacities
Notes - It is possible to specify any custom event type that could be generated
in a subform via the new CALL SUBFORM CONTAINER command. This
command lets you call the container object method and to pass an
event code to it.
- A new form event, On bound variable change, can be managed at the
subform level (see the “Update of subform contents”paragraph on
page 74).
- When the SET TIMER command is executed in the context of a
subform (form method of subform), the On Timer event is now
generated in the subform and not in the parent form (as with previous
4D versions). This allows On Timer events to be generated with
different intervals in each subform and in the parent form.
4D v12 Upgrade 73
Chapter 4 Forms and Objects
Management of the The variable bound to the subform lets you link the two contexts (form
bound variable and subform) to put the finishing touches on sophisticated interfaces.
For example, imagine a subform representing a dynamic clock,
inserted into a parent form containing an enterable variable of the
Time type:
Parent form Subform
Both objects (time variable and subform container) have the same
variable name. In this case, when you open the parent form, 4D
synchronizes both values automatically. If the variable value is set at
several locations, 4D uses the value that was loaded last. It applies the
following loading order:
1-Object methods of subform
2-Form method of subform
3-Object methods of parent form
4-Form method of parent form
When the parent form is executed, the developer must take care to
synchronize the variables using appropriate form events. Two types of
interactions can occur: form to subform and vice versa.
Update of subform The value of the parent form variable is modified and this
contents modification must be passed on to the subform. In our example, the
time of ParisTime changes to 12:15:00, either because the user entered
it, or because it was updated dynamically (via the Current time
command for example).
74 4D v12 Upgrade
Extension of subform capacities
In this case, you must use the new On bound variable change form
event. This event must be selected in the properties of the subform; it
is generated in the form method of the subform.
Parent form
Update of parent form The contents of the subform are modified and this modification must
contents be passed on to the parent form. In our example, imagine that the
subform interface lets the user to "manually" move the hands of the
clock.
4D v12 Upgrade 75
Chapter 4 Forms and Objects
In this case, from the subform, you must assign the object value to the
variable of the parent subform container. As in the previous example,
we recommend that you use the OBJECT Get pointer command with
the Object subform container selector which returns a pointer to the
subform container.
Assigning the value to the variable generates the On Data Change form
event in the object method of the parent subform container, which lets
you perform any type of action. The event must be selected in the
properties of the subform container.
Parent form
Perform actions...
Note If you "manually" move the hands of the clock, this also generates the
On Data Change form event in the object method of the clockValue
variable in the subform.
Advanced inter- Communication between the parent form and the instances of the
form programming subform may require going beyond the exchange of a value via the
bound variable. In fact, you may want to update variables in the
subforms according to the actions carried out in the parent form and
vice versa. If we use the previous example of the "dynamic clock" type
subform, we may want to set one or more alarm times per clock.
76 4D v12 Upgrade
Extension of subform capacities
Calling of a container object from the subform via the new CALL
SUBFORM CONTAINER command,
Execution of a method in the context of the subform via the new
EXECUTE METHOD IN SUBFORM command.
Object get pointer and In addition to the "Object subform container" selector (see the “Update
Object get name of subform contents”paragraph on page 74), the Object get pointer
commands
command accepts a parameter that indicates in which subform to
search for the object whose name is specified in the second parameter.
This syntax can only be used when the "Object named" selector is
passed.
Note Also note the new OBJECT SET STYLED TEXT ATTRIBUTES command
which can be used to retrieve the name of the object that has the
focus.
New CALL SUBFORM The new CALL SUBFORM CONTAINER command lets a subform instance
CONTAINER command send an event to the subform container object, which can then process
it in the context of the parent form. The event is received in the
container object method. It may be at the origin of any event detected
by the subform (click, drag-and-drop, etc.). This mechanism is
illustrated in the following diagram:
Example of execution of the CALL PARENT OBJECT command
Parent form
xxx
Subform object
method Subform
Custom event
4D v12 Upgrade 77
Chapter 4 Forms and Objects
New EXECUTE METHOD This new command lets a form or one of its object request the
IN SUBFORM command execution of a method in the context of the subform instance, which
gives it access to the variables, objects, etc. of the subform. This
method can also receive parameters. This mechanism is illustrated in
the following diagram:
Example of execution of EXECUTE METHOD IN SUBFORM command
Parent form
xxx
EXECUTE METHOD IN
Subform SUBFORM("SF1";"meth";$curtext)
xxx
Note If the subform comes from a component, the method must have the
"Shared by components and host database" property.
GOTO OBJECT The GOTO AREA command has been renamed GOTO OBJECT and can
command (formerly now look for the destination object in the parent form even if it is
GOTO AREA)
executed from a subform (see the “GOTO OBJECT” paragraph on
page 132).
Subforms in 4D v12 lets you publish component forms as subforms in the host
components databases. This means that you can, more particularly, develop
components offering graphic objects. Note that the new "widget"
objects provided by 4D are based on the use of subforms in
components (see the “Widgets”paragraph on page 82).
78 4D v12 Upgrade
Extension of subform capacities
Publishing a subform On the component side (matrix database), only project subforms can
(component) be specified as published subforms.
New option
Note This dialog box can be accessed via the Form Properties... command of
the context menu or from the action menu of the Explorer.
You must manage the interactions between the subform and the
parent forms of the host database using the mechanisms and tools
described in the previous paragraphs.
Using a component On the host database side, it is imperative that subforms coming from
subform (host database) components must be used in page mode: in the form editor, when the
subform object is selected in the parent form, deselect the Output
subform option in the "Sub-Form" theme of the Property list.
4D v12 Upgrade 79
Chapter 4 Forms and Objects
Then, choose <None> in the "Table" menu. The forms published by the
components are then listed in the "Detail Form" menu. Their name is
followed by that of the component in parentheses. You can simply
choose from this list the form to be used in the "Detail Form" list.
Source: None
Deselected option
Library objects This library uses exclusively standard 4D objects (buttons, text areas,
etc.) with certain properties that have been predefined in order to
accelerate and facilitate their implementation. For example, the
"password entry area" object is a text variable associated with a specific
style sheet. The library also offers high-level objects such as the
datepicker and timepicker widgets (see the “Widgets”paragraph on
page 82).
Note Unlike user object libraries, the preconfigured object library of 4D v12
cannot be modified: you cannot add or remove objects from this
library.
Using the library The preconfigured object library appears as a separate window. Objects
can be inserted into the form editor via drag-and-drop.
80 4D v12 Upgrade
Preconfigured object library
Object category
selection menu Filtering by platform
4D v12 Upgrade 81
Chapter 4 Forms and Objects
The central area displays a preview as well as the name of each object.
You can click on the object to obtain information about it: its
description is shown in the lower part of the window.
Widgets
4D v12 lets you take advantage of predefined compound objects. These
widgets, which can be used with or without programming, give access
to standard functionalities that are very simple to implement. The
following new objects are available:
SearchPicker: search area with standard appearance.
Note Widgets can also be accessed via the new integrated object library
integrated of 4D (see the “Preconfigured object library”paragraph on
page 80).
SearchPicker With the SearchPicker widget, you can easily create standard search
areas, similar to those found in browsers or tool bars. The appearance
of the area depends on the platform.
Windows Mac OS
82 4D v12 Upgrade
Widgets
4D v12 Upgrade 83
Chapter 4 Forms and Objects
Creation You can insert a SearchPicker area into a form using the new integrated
object library of 4D (see the “Preconfigured object library” paragraph
on page 80).
You can also create a subform and assign to it the detail form of the a
SearchPicker component, as described in the “Using a component
subform (host database)”paragraph on page 79.
Area displayed in
the form
Choice of SearchPicker
subform
Then specify the name of the variable bound with the subform
(Variable Name property in the Property list). When the form is
executed, this variable will automatically contain the value searched
for by the user. You can then pass this value to your custom search
method.
DatePicker The DatePicker widget is an intuitive, easy-to-use object that you can
use to make the most of any fields that require dates to be entered or
simply represented.
84 4D v12 Upgrade
Widgets
DatePicker calendar During execution, the user can scroll through the months of the
calendar both forwards and backwards by clicking on the arrow
buttons. They can also use the arrow keys of the keyboard.
4D v12 Upgrade 85
Chapter 4 Forms and Objects
Then specify the name of the variable bound with the subform
(Variable Name property in the Property list).
When the form is executed, this date variable automatically contains
the date selected by the user. Conversely, if you modify the value of
this variable by programming, it will be shown automatically in the
subform.
Use in a pop-up
You can use a DatePicker calendar as a pop-up window. To do this,
simply call the DatePicker Display Dialog component method. The
method returns the date selected by the user.
DateEntry area A DateEntry type area facilitates the entry of a date in the standard
DD/MM/YY form.
During execution, the buttons located to the right of the entry area are
only displayed when the object has the focus. The user selects each
element of the date (day, month or year) individually by clicking or
hitting the Tab key and can scroll them using the numeric stepper or
the arrow keys of the keyboard. The calendar icon to the right can be
used to select a date from a DatePicker pop-up calendar.
86 4D v12 Upgrade
Widgets
Then specify the name of the variable bound with the subform
(Variable Name property in the Property list).
When the form is executed, this variable will automatically contain
the date selected by the user. Conversely, if you modify the value of
this variable by programming, it will automatically be shown in the
subform.
TimePicker The TimePicker widget provides easy-to-use objects that you can use to
make the most of fields where times are to be entered or displayed.
4D v12 Upgrade 87
Chapter 4 Forms and Objects
Double pop-up
88 4D v12 Upgrade
New form objects
New stepper object 4D v12 offers a new form object: the "stepper". This standard object lets
the user scroll through numeric values, durations (times) or dates by
predefined steps by clicking on the arrow buttons:
To add a stepper to a form, you must draw a ruler object and then
select Numeric stepper in the "Display" menu of the Property list:
"Ruler" object
You can set the Minimum, Maximum and Step properties for steppers.
The other properties, in particular the form events, work the same way
as for all indicator objects.
4D v12 Upgrade 89
Chapter 4 Forms and Objects
For values of the time type, the Minimum, Maximum and Step
properties represent seconds. For example, to set a stepper from 8:00 to
18:00 with 10-minute steps:
Minimum = 28 800 (8*60*60)
Maximum = 64 800 (18*60*60)
Step = 600 (10*60)
For values of the date type, the value entered in the Step property
represents days. The Minimum and Maximum properties are ignored.
Note It is possible to activate the "Stepper" display using the OBJECT SET
FORMAT command (new name of the SET FORMAT command).
Asynchronous Preliminary note: In 4D v12, for better accuracy and conformity with
progress indicator the interface standards, the "Thermometer" objects have been renamed
"Progress Indicator."
90 4D v12 Upgrade
New form objects
Note These variants can be specified using the OBJECT SET FORMAT
command (new name of the SET FORMAT command).
New 3D buttons In 4D v12, the 3D buttons group includes four new styles that let you
use native buttons in your interfaces:
Collapse/Expand
Help
OS X Textured
OS X Gradient
4D v12 Upgrade 91
Chapter 4 Forms and Objects
These variants can be access via the Button Style pop-up menu in the
Property list for 3D buttons, 3D checkboxes and 3D radio buttons:
Collapse/Expand This button style can be used to add a standard collapse/expand icon.
These buttons are used natively in hierarchical lists. Under Windows,
the button looks like a [+] or a [-]; under Mac OS, it looks like a triangle
pointing right or down. This style is intended in particular for 3D
checkboxes, where the two states of the button correspond to the
selected/deselected state of the check box:
Windows Mac OS
Help This button style can be used to display a standard help button of the
system. You can use this style to add "system" help buttons in your
forms:
Windows Mac OS
92 4D v12 Upgrade
New form objects
Windows Mac OS
Windows Mac OS
New property
4D v12 Upgrade 93
Chapter 4 Forms and Objects
This property sets the exact number of states present in the picture
used as the icon for the 3D button. In the source picture, the states
must be stacked vertically:
Source picture State 1
State 2
State 3
State 4...
Rich text
Overview 4D v12 allows the use of rich text areas with individual style variations.
For example, it is now possible to have words in bold, italics or color
inside a text area:
This new feature applies to fields and variables of the Alpha and Text
type as well as to list box cells. It is supported for page and list forms
both for display and printing.
94 4D v12 Upgrade
Rich text
New options in the Property list can be used to configure rich text
functioning.
The attributes available are font, size, style, text color and (Windows
only) background color. To modify style attributes in a rich text area,
there are two different possibilities:
during execution, use an automatic pop-up menu (the availability
of this menu can be configured in the Property list).
by programming, using the new OBJECT SET STYLED TEXT
ATTRIBUTES command.
In rich text areas, style attributes are stored as standard HTML tags.
When the text area is displayed, these tags are interpreted by 4D. This
means that the developer can specify and modify style attributes in a
text via programming. The tags supported by 4D are described in
appendix B, “Style Tags,” on page 335.
The new OBJECT Get plain text command retrieves raw text without
style tags.
Note You cannot use rich text areas in the following contexts: entry filters,
quick reports and the label editor.
Rich text In the form editor, new properties can be used to activate and
management configure the support of rich text. These properties are available for
properties enterable variables, fields and list box cells of the Alpha or Text type.
Multi-style This option ("Text" theme) enables the possibility of using specific
styles in the selected area. When this option is checked, 4D interprets
any HTML style management tags found in the area.
Store with default style This option only appears when the "Multi-style" option has been
tags checked. It is found in the "Text" theme.
When this option is checked, the area will store the style tags with the
text, even if no modification has been made. In this case, the tags
correspond to the default style. When this option is not checked, only
modified style tags are stored.
4D v12 Upgrade 95
Chapter 4 Forms and Objects
<SPAN STYLE="font-family:'Arial';font-size:9pt;text-align:left;font-
weight:normal;font-style:normal;text-
decoration:none;color:#000000;background-color:#FFFFFF">What a <SPAN
STYLE="font-size:13.5pt">beautiful</SPAN> day!</SPAN>
Context menu This option ("Entry" theme) only appears when the "Multi-style"
option has been checked.
It can be used to activate, for the user, the possibility of calling a pop-
up menu during data entry by a right-click in the area. This pop-up
menu offers standard text editing commands (cut, copy, paste) as well
as commands for supported style modifications: font, size, style, color
and (Windows) background color.
96 4D v12 Upgrade
Rich text
When the user modifies a style attribute via this pop-up menu, 4D
generates the On After Edit form event.
Note It is also possible to modify styles via the new OBJECT SET STYLED TEXT
ATTRIBUTES command. Note that in this case, no form event is
generated.
Note The "strikethrough" style is not supported under Mac OS. However, the
corresponding tag can be used by programming.
Text object The commands that can be used to manipulate text objects by
management programming do not take any style tags integrated into the text into
commands
account. They act upon displayed text so they function as in previous
versions of 4D. This concerns the following commands:
User Interface theme
HIGHLIGHT TEXT
GET HIGHLIGHT
Note that when you use these commands with commands that
manipulate character strings, it is necessary to filter the formatting
characters using the new OBJECT Get plain text command:
HIGHLIGHT TEXT([Products]Notes;1;Length(OBJECT Get plain
text([Products]Notes))+1)
Object Properties theme
Note The commands of this theme have been renamed in 4D v12 and new
commands have been added. For more information, refer to the
“Object Properties” paragraph on page 155.
4D v12 Upgrade 97
Chapter 4 Forms and Objects
The commands that can be used to modify the style of objects (for
example, OBJECT SET FONT) work as in previous versions of 4D: they
apply to the whole object and not to the selection.
Note that if the object does not have the focus when the command is
executed, the modification is applied simultaneously to the object (the
text area) and to its associated variable. If the object does have the
focus, the modification is carried out on the object but not on the
associated variable. The modification is only applied to the variable
when the object loses the focus. Keep this principle in mind when
programming text areas.
If the "Store with default style tags" option is checked for the object,
the use of these commands will cause a modification of the tags saved
with each object.
Get edited text When it is used with a rich text area, the Get edited text command
command ("Form Events" theme) returns the text of the current area including
any style tags.
To retrieve the "plain" text (text without tags) being edited, you must
use the new OBJECT Get plain text command:
OBJECT Get plain text(Get edited text)
Note For more information about this command, refer to the “OBJECT Get
plain text” paragraph on page 165.
Query and order by Queries and sorts carried out among multi-style objects take into
commands account any style tags saved in the object. If a style modification has
been made within a word, searching for the word will not be
successful.
To be able to carry out valid searches and sorts, you must use the new
OBJECT Get plain text command. For example:
QUERY BY FORMULA([MyTable];Get plain text([MyTable]MyField-
Style)="very well")
98 4D v12 Upgrade
New properties for fields and variables
New commands Several new commands can be used to manipulate the style attributes
of rich text areas: OBJECT SET STYLED TEXT ATTRIBUTES, OBJECT GET
STYLED TEXT ATTRIBUTES and OBJECT Get plain text. These commands
are described in the “Object Properties” paragraph on page 155.
Note The new "Selection always visible" property keeps the text selection
visible in a form even when the object no longer has the focus. This
means that you can build interfaces based on menus or buttons for
style modification. For more information, refer to “Selection always
visible”paragraph on page 103.
Objects not In previous versions of 4D, the contents of fields and variables that
enterable were declared non-enterable (Enterable option deselected) could not
be selected or copied. Henceforth, new interaction possibilities are
provided via the availability of the Focusable, Tabable and Droppable
properties.
Focusable and Tabable The Focusable and Tabable options are active for objects that are not
enterable:
4D v12 Upgrade 99
Chapter 4 Forms and Objects
When the Focusable option is checked for the object, the user can
select, copy or even transport via drag-and-drop, the contents of the
area.
Droppable The Droppable property can now be assigned to an object that is not
enterable. This means that the developer can program all types of
action in response to an object being dropped on a field or variable
that is not enterable.
Multiline objects In previous versions of 4D, the display and printing of text in fields
and variables of the form were difficult to control. In objects of the text
type, the display could depend on the size of the area and the
platform.
Multiline = Automatic In single-line areas, words located at the end of lines are truncated and
there are no line returns.
In multiline areas, 4D carries out automatic line returns:
Multiline = No In single-line areas, words located at the end of lines are truncated and
there are no line returns.
There are never line returns: the text is always displayed on a single
row. If the Alpha or Text field or variable contains carriage returns, the
text located after the first carriage return is removed as soon as the area
is modified:
Wordwrap = Yes
In single-line areas, only the last word that can be displayed entirely is
displayed. 4D inserts line returns; it is possible to scroll the contents of
the area by pressing the down arrow key.
In multiline areas, 4D carries out automatic line returns:
Wordwrap = No
4D does not do any automatic line returns and the last word that can
be displayed may be truncated. In text type areas, carriage returns are
supported:
Note For these properties to be taken into account correctly, text objects
must not have scroll bars.
Selection always A new property is available for Alpha or Text type fields or variables in
visible forms: Selection always visible:
New option
This property keeps the selection visible within the object after it has
lost the focus. This makes it easier to implement interfaces that allow
the text style to be modified (see the “Rich text”paragraph on page 94).
List boxes
4D v12 brings several new features relating to list boxes:
The possibility of specifying hierarchical list boxes,
Hierarchical list 4D v12 lets you specify and use hierarchical list boxes. A hierarchical
boxes list box is a list box in which the contents of the first column appears
in hierarchical form. This type of representation is adapted to the
presentation of information that includes repeated values and/or
values that are hierarchically dependent (country/region/city and so
on).
New list box properties New properties can be used to manage hierarchical list boxes. Note
that these properties are automatically modified if you specify the
hierarchy via the pop-up menu of the list box object (see the
“Managing hierarchy with context menu” paragraph on page 107).
To specify a hierarchical list box, you simply need to check the new
Hierarchical list box option. This option is found in the new
"Hierarchy" theme of the Property list, which is available when a list
box object is selected:
New theme
This option is only present for list boxes whose data source is Arrays.
Variable 1 ... 10
The first variable always corresponds to the name of the variable for
the first column of the list box (the two values are automatically
bound). This first variable is always visible and enterable. For example:
country.
The second variable is also always visible and enterable; it specifies the
second hierarchical level. For example: regions.
Beginning with the third field, each variable will depends on the one
preceding it. For example: counties, cities, and so on. A maximum of
ten hierarchical levels can be specified.
This principle is not applied when only one variable is specified in the
hierarchy: in this case, identical values may be grouped.
Note If you specify a hierarchy based on the first columns of an existing list
box, you must then remote or hide these columns (except for the first),
otherwise they will appear in duplicate in the list box. If you specify
the hierarchy via the pop-up menu of the editor (see the “Managing
hierarchy with context menu” paragraph on page 107), the
unnecessary columns are automatically removed from the list box.
Modified properties
Managing hierarchy The context menu of the form editor offers two new commands when
with context menu you click on a list box object: Create hierarchy and Cancel hierarchy.
Create hierarchy
When you select at least one column in addition to the first one in a
list box object (of the array type) in the form editor, the Create
hierarchy command is available in the context menu:
When you choose this command, the following actions are carried out:
The "Hierarchical list box" option is checked for the object (see the
“Hierarchical list box”paragraph on page 105).
The variables of the columns are used to specify the hierarchy (see
the “Variable 1 ... 10”paragraph on page 105). They replace any
variables already specified.
The columns selected no longer appear in the list box (except for
the title of the first one).
Cancel hierarchy
Functioning of When a form containing a hierarchical list box is opened for the first
hierarchical list boxes time, by default all the rows are expanded.
If this list box is displayed in hierarchical form (the first three arrays
being included in the hierarchy), you will obtain:
The arrays are not sorted before the hierarchy is constructed. If, for
example, an array contains the data AAABBAACC, the hierarchy
obtained will be:
X A
X B
X A
X C
Regardless of how the data are displayed in the list box (hierarchically
or not), if you want to change the row containing "Quimper" to bold,
you must use the statement Style{2} = bold. Only the position of the
row in the arrays is taken into account.
For example, if you want to select the row containing Rennes, you
must pass:
-> MyListbox{3}:=True
Non-hierarchical representation:
France Brittany Brest
France Brittany Quimper
France Brittany Rennes
Hierarchical representation:
France
Brittany
Brest
Quimper
Rennes
Note If one or more rows are hidden because their parents are collapsed,
they are no longer selected. Only the rows that are visible (either
directly or by scrolling) can be selected. In other words, rows cannot be
both hidden and selected.
Management of break If the user selects a break row, LISTBOX GET CELL POSITION returns the
rows first occurrence of the row in the corresponding array. In the following
case:
France
Brittany
Brest 120000
Quimper 80000
Rennes 200000
Normandy
Caen 75000
... LISTBOX GET CELL POSITION returns (2;4). To select a break row by
programming, you must use the new LISTBOX SELECT BREAK command
on page 151.
Break rows are not taken into account in the internal arrays used to
manage the graphic appearance of list boxes (styles and colors). It is
however possible to modify these characteristics for break rows via the
graphic management commands for objects ("Object Properties"
theme). You simply need to execute the appropriate commands on the
arrays that constitute the hierarchy.
Given for example the following list box (the names of the associated
arrays are specified in parentheses):
Non-hierarchical representation:
(T1) (T2) (T3) (T4) (tStyle) (tColor)
France Brittany Brest 120000 Normal 0
France Brittany Quimper 80000 Underline 0
France Brittany Rennes 200000 Normal 0xFF0000
France Normandy Caen 220000 Normal 0
France Normandy Deauville 4000 Normal 0
Hierarchical representation:
France
Brittany
Brest 120000
Quimper 80000
Rennes 200000
Normandy
Caen 75000
Deauville 4000
In hierarchical mode, break levels are not taken into account by the
style modification arrays named tStyle and tColors. To modify the color
or style of break levels, you must execute the following statements:
OBJECT SET RGB COLORS(T1;0x0000FF;0xB0B0B0)
OBJECT SET FONT STYLE(T2;Bold)
In this context, only the syntax using the array variable can function
with the object property commands because the arrays do not have
any associated object.
Result:
France
Brittany
Brest 120000
Quimper 80000
Rennes 200000
Normandy
Caen 75000
Deauville 4000
Managing sorts In a list box in hierarchical mode, a standard sort (carried out by
clicking on the header of a list box column) is always constructed as
follows:
In the first place, all the levels of the hierarchical column (first
column) are automatically sorted by ascending order,
The sort is then carried out by ascending or descending order
(according to the user action) on the values of the column that was
clicked.
All the columns are synchronized.
As for all list boxes, you can disable the standard sort mechanism by
deselecting the "Sortable" option for the list box and managing sorts
using programming.
Display of dates and When values of the date or time type are included in a hierarchical list
times box, they ar displayed in a standard format:
Dates are displayed in the short system format (for example, for May
30, 2009, "05/30/09" on an American system and "30/05/09" on a
European system).
Times are also displayed in the short system format ("12:15:30" or
"12:15" depending on the system parameters).
Hidden rows When all the rows of a sub-hierarchy are hidden, the break line is
automatically hidden. In the above example, if rows 1 to 3 are hidden,
the "Brittany" break row will not appear.
Scrolling and editing The OBJECT SET SCROLL POSITION (formerly SCROLL LINES) and EDIT
ITEM commands have been adapted for list boxes displayed in
hierarchical mode: if the row aimed at belongs to a collapsed
hierarchical level, this level as well as any parent levels are
automatically expanded for the row to be visible.
Printing list boxes It is now possible to print list boxes in 4D v12. Two printing modes are
available: preview mode, which can be used to print a list box like a
form object and advanced mode, which lets you control the printing
of the list box object itself within the form. A new property specifies
the "Printing" appearance for list box objects.
Preview mode Printing a list box in preview mode consists in directly printing the list
box with the form that contains it using the standard print commands
or the Print menu command. The list box is printed as it is in the form.
This mode does not allow precise control of the printing of the object;
in particular, it does not allow you to print all the rows of a list box
that contains more rows than it can display.
Advanced mode In this mode, the printing of list boxes is carried out by programming,
via the new Print object command. Accordingly, only list boxes found
in project forms can be printed in advanced mode. The new LISTBOX
GET PRINT INFORMATION command is used to control the printing of
the object.
In this mode:
The height of the list box object is automatically reduced when the
number of rows to be printed is less than the original height of the
object (there are no "blank" rows printed). On the other hand, the
height does not automatically increase according to the contents of
the object. The size of the object actually printed can be obtained via
the LISTBOX GET PRINT INFORMATION command.
The list box object is printed "as is", in other words, taking its current
display parameters into account: visibility of headers and gridlines,
hidden and displayed rows, etc.
These parameters also include the first row to be printed: if you call the
OBJECT SET SCROLL POSITION command before launching the
printing, the first row printed in the list box will be the one designated
by the command.
Printing property In the Property list, a new platform option is available for list boxes
("Appearance" theme): Printing.
If you select this option, the appearance of the list box is adapted for
printing: headers in black and white, check boxes printed as [x], etc.
The Printing appearance does not depend on the platform where it is
running.
If you do not check this option, the list box will be printed with the
appearance of the current platform.
Note In advanced mode, the scroll bars of list boxes are never printed,
regardless of the appearance chosen.
Access to data of It is now possible to retrieve the contents of columns that are
added SELECT automatically added to a list box by 4D following a SELECT query
columns whose result produces a number of columns greater than that of the
list box.
Note that data entry and sorting are now possible for these columns.
A new form event is generated when the user clicks on the button.
Toolbar property For 4D to display the toolbar management button in your windows,
you have two solutions:
Check the new Toolbar button (Mac OS) property that is available in
the "Appearance" theme of the Property list:
This option is to be used if you create the window with the Open form
window or DIALOG command for example.
Use the new Has toolbar button Mac OS constant. This option is to be
used with the Open window or Open form window command (see the
“Open window” paragraph on page 257).
On Mac toolbar The new On Mac toolbar button form event is generated in the form
button form event method when the user clicks on the tool bar management button of
the window under Mac OS. Of course, the corresponding property
must have been checked in the properties of the form event.
Only the event is generated, 4D does not carry out any other action in
the window. It is up to the developer to modify the size of the window
and to show or hide its interface elements.
This chapter covers the new features and modifications made to the
programming language of 4D v12.
4D Environment
The new SET DATABASE LOCALIZATION command modifies the current
language of the database and is used in particular for the application
interface (XLIFF architecture). The Version type command accepts new
values that are used to identify a 64-bit 4D Server. Moreover, new
selectors are available for the SET DATABASE PARAMETER and Get
database parameter command.
` This maintenance method lets you request the compacting of the data
file in the case where there is considerable fragmentation in at least
one table of the database:
ToBeCompacted:=False
For ($i ;1;Get last table number)
If(Is table number valid($i))
If(Get table fragmentation(Table($i)->)>20)
ToBeCompacted:=True
End if
End if
End for
If(ToBeCompacted)
// Places a marker requesting compacting
End if
Here is the list of keys that can now be used in the selector parameter.
The first part of the key indicates the dialog box concerned:
/4D
/4D/General
/4D/Structure
/4D/Form editor
/4D/Method editor
/4D/Client-Server
/4D/Shortcuts
/Database
/Database/General
/Database/Mover
/Database/Interface
/Database/Interface/Developer
/Database/Interface/User
/Database/Interface/Shortcuts
/Database/Compiler
/Database/Database
/Database/Database/Data storage
/Database/Database/Memory and cpu
/Database/Database/International
/Database/Backup
/Database/Backup/Scheduler
/Database/Backup/Configuration
/Database/Backup/Backup and restore
/Database/Client-Server
/Database/Client-Server/Network
/Database/Client-Server/IP configuration
/Database/Web
/Database/Web/Config
/Database/Web/Options 1
/Database/Web/Options 2
/Database/Web/Log format
/Database/Web/Log scheduler
/Database/Web/Webservices
/Database/SQL
/Database/php
/Database/Compatibility
/Database/Security
If you pass an invalid key or just a slash ("/"), the command displays
the Database Settings dialog box, open to the last page that was
consulted.
Compatibility note The command continues to function with the keys of previous
versions; the correspondence is established automatically by 4D. It is
nevertheless recommended to replace the former calls using the v12
keys.
The new access parameter lets you control user actions in the
Preferences or Database Settings dialog box by locking the other pages.
Typically, you may want for the user to be able to customize certain
parameters while preventing others from being modified. In this case,
passing True in the access parameter means that only the page specified
by the selector parameter will be active and modifiable, while access to
all other pages will be locked (clicking on the buttons in the
navigation bar will have no effect). If you pass False or omit the access
parameter, all the pages of the dialog box will be accessible with no
restriction.
The current language of the database specifies the .lproj folder where
the program will look for the localized elements of the application
(text and pictures). By default, 4D automatically determines the
current language according to the contents of the Resources folder and
the system environment (see the description of the Get database
localization command). SET DATABASE LOCALIZATION modifies the
default current language.
The command does not modify the language of forms that are already
loaded, only elements displayed after the command is called will take
the new configuration into account.
Note In accordance with the RFC, the command uses the "-" (dash) to
separate the language code and the region code, for example "fr-ca" or
"en-us". On the other hand, the "lproj" folders of the Resources folder
use the "_" (underscore), for example "fr_ca.lproj" or "en_us.lproj".
4D Server With 4D Server, the languages available are those located on the
remote machine that called the command. You must therefore make
sure that the Resources folders are synchronized.
FR_CA folder:
<trans-unit id="15" resname="Shopping">
<source>Shopping</source>
<target>Magasiner</target>
</trans-unit>
SET DATABASE LOCALIZATION("fr")
`the string ":xliff:shopping" displays "Faire les courses"
SET DATABASE LOCALIZATION("fr-ca")
`the string ":xliff:shopping" displays "Magasiner"
See Also: Get database localization
Note Under Mac OS, all the child processes share the same port.
Under Windows, each child process uses a specific port number. The
first number is the one set for the PHP interpreter; the other child
processes increment the first one. For example, if the default port is
8002 and you launch 5 child processes, they will use ports 8002 to
8006.
Note This parameter can also be modified globally for all the machines via
the Database Settings (see the “PHP” paragraph on page 39).
Note This parameter can also be modified globally for all the machines via
the Database Settings (see the “PHP” paragraph on page 39).
Note This parameter can also be modified globally for all the machines via
the Database Settings (see the “PHP” paragraph on page 39).
Backup
RESTORE RESTORE{(archivePath{; destFolderPath})}
Parameter Type Description
archivePath Text Æ Pathname of archive to restore
destFolderPath Text Æ Pathname of destination folder
The RESTORE command now accepts two optional parameters that can
be used to automate the restore process and to update the OK and
document system variables.
You can also pass the destFolderPath parameter with the pathname of
the destination folder of the restored elements. This pathname must be
expressed with the system syntax. You can pass an absolute pathname
or a pathname relative to the database structure file. If you pass this
parameter, a preconfigured restore dialog box appears so that the user
can launch or cancel the restore procedure. When the procedure is
completed, the window is simply reclosed without displaying any
additional information.
Communications
RECEIVE PACKET RECEIVE PACKET({docRef ;} receiveVar ; stopChar | numBytes)
The RECEIVE PACKET command now supports BOMs (Byte Order Marks)
when receiveVar is a string type variable.
In this case, if the current character set is of the Unicode type (UTF-8,
UTF-16 or UTF-32), 4D attempts to identify a BOM among the first
bytes received. If it is detected, is filtered out of the variable receiving
the data and 4D uses the character set that it defines instead of the
current character set.
In this case, the command returns the vertical location of the click
and, in the optional pictPosX parameter, the horizontal location of the
click. The values returned are expressed in pixels and in relation to the
local coordinate system.
See Also: OBJECT GET SCROLL POSITION, OBJECT SET SCROLL POSITION
Entry Control
GOTO OBJECT GOTO OBJECT({*;}object)
Compatibility note The GOTO OBJECT command was named GOTO AREA in previous
versions of 4D.
Form Events
CALL SUBFORM CALL SUBFORM CONTAINER(event)
CONTAINER Parameter Type Description
event Longint Æ Event to be sent
In event, you can pass any predefined form event of 4D available for a
subform container object (you can use the constants of the "Form
Events" theme) or any value corresponding to a custom event. In the
first case, the event must be checked for the subform container object.
In the case of a custom event, it is recommended to pass a negative
value in event to avoid the risk of interfering with existing or future 4D
event numbers.
Example of execution of the CALL SUBFORM CONTAINER command
Parent form
xxx
Object method of
subform Subform
Custom event
Forms
To facilitate their use, the commands of this theme have been renamed
and two additional commands have been added.
The new FORM GET VERTICAL RESIZING command returns the vertical
resizing properties of the current form in the resize, minHeight and
maxHeight variables. These properties may have been set for the form
in the Form editor in Design mode or for the current process via the
FORM SET VERTICAL RESIZING command.
Interruptions
Four new commands support assertions in the 4D code. These new
tools facilitate the debugging of applications that are in the process of
being developed.
Note Two new system variables can be used to recover the precise location of
programming errors. For more information, refer to the “New system
variables” paragraph on page 254.
The command accepts an optional second parameter that you can use
to provide the text that will appear in the error message instead of the
text of the Boolean expression when it is false.
The new Get assert enabled command returns True or False according to
whether or not assertions are enabled in the database. For more
information about assertions, refer to the description of the ASSERT
command.
By default, assertions are enabled but they may have been disabled
using the SET ASSERT ENABLED command.
By default, the SET ASSERT ENABLED command affects all the processes
of the application. To restrict the effect of the command to the current
process only, you can pass the * parameter.
` Disabling assertions:
SET ASSERT ENABLED(False)
ASSERT(TestMethod) // TestMethod will not be called since assertions are
disabled
Ignore repeated The error window of 4D provides a new shortcut that can be used to
errors in the error ignore an error that occurs repeatedly, for example in a loop.
window
To do so, hold down the Alt (Windows) or Option (Mac OS) key when
you click on the Continue button in the 4D error window. This action
means that the window will no longer be shown if the same error,
triggered by the same method at the same line, occurs again. In this
case, everything continues as if the user was clicking on the Continue
button each time.
Language
EXECUTE METHOD EXECUTE METHOD IN SUBFORM(subformObject; methodName{; return{;
IN SUBFORM param;...;paramN}})
Parameter Type Description
subformObject String Æ Name of subform object
methodName String Æ Name of project method to be executed
return Variable | * Å Value returned by method or
* if method does not return a value
param Variable Æ Parameter(s) to pass to method
You can pass the name of any project method that is accessible from
the database or the component executing the command. The
execution context is preserved in the method called, which means that
the current form and current form event remain specified. If the
subform comes from a component, the method must belong to the
component and have the "Shared by components and host database"
property.
This command must be called from the form method of the parent
form (containing the subformObject object).
If this method was used directly in the Calendar form method, you
could call it directly in the "On Load" event: SetCalendarDate(Current
date). But, in the context of the host database, imagine that a project
form contains two "Calendar" subforms, in subform objects called
"Cal1" and "Cal2". You must set the date of Cal1 to 01/01/10 and the
date of Cal2 to 05/05/10. You cannot call SetCalendarDate directly
because the method will not "know" which forms and variables it
should apply. Therefore, you must call it via the following code:
EXECUTE METHOD IN SUBFORM("Cal1";
"SetCalendarDate";*;!01/01/10!)
EXECUTE METHOD IN SUBFORM("Cal2";
"SetCalendarDate";*;!05/05/10!)
: (Count parameters=2)
// External call, needs a context
// Recursive call with only one parameter
EXECUTE METHOD IN SUBFORM($2;"SetCalendarDate";*;$1)
End case
List Box
Several modifications have been made to the List Box theme of 4D
v12:
Four new commands are dedicated to the management of hierarchical
list boxes (for more information about hierarchical list boxes, refer to
“List boxes” paragraph on page 104),
The new LISTBOX GET PRINT INFORMATION command controls the
printing of list boxes,
New parameters for the LISTBOX SET COLUMN WIDTH and LISTBOX Get
column width commands can be used to control the resizing of
columns.
To facilitate their use via autocomple functions, all the commands
have been prefixed LISTBOX.
The LISTBOX COLLAPSE command collapses the break rows of the list
box object designated by the object and * parameters.
If you pass the optional * parameter, you indicate that the object
parameter is an object name (string). If you do not pass this parameter,
you indicate that the object is a variable. In this case, you pass a
variable reference instead of a string.
If the selection or list box does not contain a break row or if all the
break rows are already collapsed, the command does nothing.
` This example collapses the first level of the break rows of the selection
in the list box:
LISTBOX COLLAPSE (*;"MyListbox";False;Listbox selection)
The LISTBOX EXPAND command expands the break rows of the list box
object designated by the object and * parameters.
If you pass the optional * parameter, you indicate that the object
parameter is an object name (string). If you do not pass this parameter,
you indicate that the object is a variable. In this case, you pass a
variable reference instead of a string.
If the selection or list box does not contain a break row or if all the
break rows are already expanded, the command does nothing.
// Expand all the break rows and subrows of the list box
LISTBOX EXPAND(*;"MyListbox")
V France
V Brittany
Brest 120000
Quimper 80000
Rennes 200000
V Normandy
Caen 220000
Deauville 4000
Cherbourg 41000
V Belgium
V Wallonia
Namur 111000
Liege 200000
V Flanders
Antwerp 472000
Louvain 95000
LISTBOX Get column LISTBOX Get column width({*; }object{; minWidth{; maxWidth}}) Æ Longint
width Parameter Type Description
* Æ If specified, object is an object name
(string)
If omitted, object is a variable
object Form object Æ Object name (if * is specified) or
Variable (if * is omitted)
minWidth Longint Å Minimum column width (in pixels)
maxWidth Longint Å Maximum column width (in pixels)
The LISTBOX Get column width command can now return the resizing
limits of the column in the minWidth and maxWidth parameters.
These limits can be specified via the LISTBOX SET COLUMN WIDTH
command.
If no minimum and/or maximum value has been set for the column,
the corresponding parameter returns 0.
The new LISTBOX GET HIERARCHY command lets you find out the
hierarchical properties of the list box object designated by the object
and * parameters.
If you pass the optional * parameter, you indicate that the object
parameter is an object name (string). If you do not pass this parameter,
you indicate that the object is a variable. In this case, you pass a
variable reference instead of a string.
If the list box is in hierarchical mode, the command fills the hierarchy
array with pointers to the arrays of the list box used to set the
hierarchy.
LISTBOX GET PRINT LISTBOX GET PRINT INFORMATION ({*; }object; selector; info)
INFORMATION Parameter Type Description
* Æ If specified, object is an object name
(string)
If omitted, object is a variable
object Form object Æ Object name (if * is specified) or
Variable (if * is omitted)
selector Longint Æ Information to get
info Longint | Å Current value
Boolean
If you pass the optional * parameter, you indicate that the object
parameter is an object name (string). If you do not pass this parameter,
you indicate that the object is a variable. In this case, you pass a
variable reference instead of a string.
Pass a value indicating the information you want to find out in selector
and a variable of the number or BLOB type in info. In selector, you can
pass one of the following constants, found in the "List box" theme:
selector Value returned in info
Listbox Last printed Returns in info the number of the last row printed.
row number (0) Lets you find out the number of the next row to
be printed.
The number returned may be greater than the
number of rows actually printed if the list box
contains invisible rows or if the OBJECT SET
SCROLL POSITION command has been called.
For example, if rows 1, 18 and 20 have been
printed, info is 20.
` Printing at least 500 rows of the list box, knowing that certain rows are
hidden:
$GlobalPrinted:=0
Repeat
PRINT OBJECT (*;"mylistbox")
LISTBOX GET PRINT INFORMATION(*;"mylistbox";
Listbox Printed rows;$Printed)
$GlobalPrinted:=$GlobalPrinted+$Printed
PAGE BREAK
Until ($GlobalPrinted>=500)
The new LISTBOX SELECT BREAK command selects break rows in the list
box object designated by the object and * parameters. The list box must
be displayed in hierarchical mode.
If you pass the optional * parameter, you indicate that the object
parameter is an object name (string). If you do not pass this parameter,
you indicate that the object is a variable. In this case, you pass a
variable reference instead of a string.
Break rows are added to represent the hierarchy but they do not
correspond to existing rows in the array. To designate a break row to be
selected, in the row and column parameters, you must pass the row and
column number corresponding to the first occurrence in the
corresponding array. These values are returned by the LISTBOX GET
CELL POSITION command when the user has selected a break row. This
principle is described in the “Management of selections and positions”
paragraph on page 109.
Remove from listbox selection (2): The selected break row is removed
from the existing selection. If the break row designated does not
belong to the existing selection, the command does nothing.
LISTBOX SET LISTBOX SET COLUMN WIDTH({*; }object; width{; minWidth{; maxWidth}})
COLUMN WIDTH Parameter Type Description
* Æ If specified, object is an object name
(string)
If omitted, object is a variable
object Form object Æ Object name (if * is specified) or
Variable (if * is omitted)
width Longint Æ Column width (in pixels)
minWidth Longint Æ Minimum column width (in pixels)
maxWidth Longint Æ Maximum column width (in pixels)
If you want users to be unable to resize the column, you can pass the
same value in width, minWidth and maxWidth.
The new LISTBOX SET HIERARCHY command lets you configure the list
box object designated by the object and * parameters in hierarchical or
non-hierarchical mode.
Note This command only functions with list boxes based on arrays. When
this command is used with a list box based on selections, it does
nothing.
If you pass the optional * parameter, you indicate that the object
parameter is an object name (string). If you do not pass this parameter,
you indicate that the object is a variable. In this case, you pass a
variable reference instead of a string.
The Boolean hierarchical parameter lets you specify the list box mode:
If you pass True, the list box is displayed in hierarchical mode,
When you pass a list box in hierarchical mode, certain properties are
automatically restricted. For more information, refer to the “Modified
properties” paragraph on page 107.
The hierarchy parameter designates the arrays of the list box to be used
to build the hierarchy.
If you omit this parameter:
If the list box is already in hierarchical mode, the command does
nothing.
If the list box is in non-hierarchical mode and has never been
declared hierarchical, the first array is used as the hierarchy by
default.
If the list box is in non-hierarchical mode but has previously been
declared hierarchical, the last hierarchy is re-established.
Insertion or deletion The existing LISTBOX INSERT COLUMN, LISTBOX INSERT COLUMN
commands FORMULA and LISTBOX DELETE COLUMN commands do not have any
effect when they are applied to the first column of a list box displayed
in hierarchical mode.
Note These commands are renamed in 4D v12 (see the paragraph below).
Object Properties
The commands of this theme have undergone numerous
modifications in 4D v12:
New properties can be accessed via new commands.
ENABLE BUTTON, The ENABLE BUTTON and DISABLE BUTTON commands are declared
DISABLE BUTTON obsolete in 4D v12. They are kept for compatibility reasons only. Their
overall scope, including all the instances of the designated variable and
not only those of the current form, does not correspond to that of the
commands of the "Object Properties" theme.
In 4D v12, ENABLE BUTTON and DISABLE BUTTON are favorably replaced
by the new OBJECT SET ENABLED and OBJECT Get enabled commands.
By default, all the options specified in the Property list for the source
object are applied to the copy (size, resizing options, color, etc.),
including any associated object method.
If you pass the optional * parameter, you indicate that the object
parameter is an object name (string). If you do not pass this parameter,
you indicate that the object is a field or a variable. In this case, you pass
a field or variable reference (object field or variable only) instead of a
string.
If you pass a field or variable reference and if the form contains several
objects that use the same reference, the first occurrence found will be
used. In this case, to avoid any ambiguity, it is recommended to work
with object names, that are unique.
Pass the name assigned to the copy of the object in the newName
parameter. This name must be in keeping with the rules for naming
objects and be unique in the form. If it is not valid or already used by
another object, the command does nothing and the OK variable
returns 0.
If you omit this parameter or pass an empty string, the new name is
automatically generated by incrementation of the source object name
(if this name is not already used). For example:
Source name Name of copy
Button Button1
Button20 Button21
Button21 Button23 if Button22 already exists
If the variable type is not compatible with the object, the command
does nothing and the OK variable is set to 0.
If you omit this parameter, the variable is created dynamically by 4D
(see the “Dynamic variables” paragraph on page 255).
If you duplicate a static object (lines, rectangle, static picture, etc.), this
parameter is ignored. Pass a Nil pointer (->[]) if you want to be able to
use the other parameters.
If you omit this parameter or pass an empty string, the new object
becomes the last enterable object of the form page. In the case of a
radio button, the object is attached to the group of the source button.
The new object can be moved and resized via the moveH, moveV,
resizeH and resizeV parameters. As with the OBJECT MOVE command,
the direction of the move or the resizing is specified by the sign of the
values passed in the moveH and moveV parameters:
If the value is positive, the move or resizing is carried out, respectively,
to the right or downwards.
If the value is negative, the move or resizing is carried out, respectively,
to the left or upwards.
By default, the values of moveH, moveV, resizeH and resizeV modify the
coordinates of the object in relation to its previous position. If you
want for these parameters to specify absolute coordinates, pass the
optional final * parameter.
Note If the On Load form event is associated with the source object, it is
generated for the duplicated object when the command is executed.
This allows, for example, the value of the object to be initialized.
OBJECT Get choice OBJECT Get choice list name ({*; }object) Æ String
list name Parameter Type Description
* * Æ If specified, object is an object name
(string)
If omitted, object is a variable or a
field
object Form object Æ Object name (if * is specified) or
Variable or field (if * is omitted)
The new OBJECT Get choice list name command returns the name of
the choice list associated with the object or group of objects designated
by object.
If you pass the optional * parameter, you indicate that the object
parameter is an object name (string). If you do not pass this parameter,
you indicate that the object is a field or a variable. In this case, you pass
a field or variable reference (object field or variable only) instead of a
string.
The new OBJECT Get enabled command returns True if the object or
group of objects designated by object is enabled in the form and False if
it is not enabled.
If you pass the optional * parameter, you indicate that the object
parameter is an object name (string). If you do not pass this parameter,
you indicate that the object is a variable. In this case, you pass a
variable reference (object variable only) instead of a string.
Thermometer, Ruler
The new OBJECT Get enterable command returns True if the object or
group of objects designated by object has the enterable attribute;
otherwise, it returns False.
If you pass the optional * parameter, you indicate that the object
parameter is an object name (string). If you do not pass this parameter,
you indicate that the object is a field or a variable. In this case, you pass
a field or variable reference (object field or variable only) instead of a
string.
The new OBJECT Get filter command returns the name of any filter
associated with the object or group of objects designated by object.
If you pass the optional * parameter, you indicate that the object
parameter is an object name (string). If you do not pass this parameter,
you indicate that the object is a field or a variable. In this case, you pass
a field or variable reference (object field or variable only) instead of a
string.
The new OBJECT Get font command returns the name of the character
font used by the form object(s) designated by object.
If you pass the optional * parameter, you indicate that the object
parameter is an object name (string). If you do not pass this parameter,
you indicate that the object is a field or a variable. In this case, you pass
a field or variable reference (object field or variable only) instead of a
string.
OBJECT Get font size OBJECT Get font size ({*; }object) Æ Longint
Parameter Type Description
* * Æ If specified, object is an object name
(string)
If omitted, object is a variable or a field
object Form object Æ Object name (if * is specified) or
Variable or field (if * is omitted)
The new OBJECT Get font size command returns the size (in points) of
the character font used by the form object(s) designated by object.
If you pass the optional * parameter, you indicate that the object
parameter is an object name (string). If you do not pass this parameter,
you indicate that the object is a field or a variable. In this case, you pass
a field or variable reference (object field or variable only) instead of a
string.
OBJECT Get font OBJECT Get font style ({*; }object) Æ Longint
style Parameter Type Description
* * Æ If specified, object is an object name
(string)
If omitted, object is a variable or a field
object Form object Æ Object name (if * is specified) or
Variable or field (if * is omitted)
The new OBJECT Get font style command returns the current style of
the character font used by the form object(s) designated by object.
If you pass the optional * parameter, you indicate that the object
parameter is an object name (string). If you do not pass this parameter,
you indicate that the object is a field or a variable. In this case, you pass
a field or variable reference (object field or variable only) instead of a
string.
You can compare the value returned with the value of one or more of
the following predefined constants, placed in the "Font Styles" theme:
Constant Type Value
Plain Longint 0
Bold Longint 1
Italic Longint 2
Underline Longint 4
The new OBJECT Get plain text command removes any style tags from
the text variable or field designated by the * and object parameters and
returns the plain text.
If you pass the optional * parameter, you indicate that the object
parameter is an object name (string). If you do not pass this parameter,
you indicate that the object is a field or a variable. In this case, you pass
a field or variable reference instead of a string.
` You are looking for the text "very nice" among the values of a multi-
style text field. The value was stored in the following form: "The
weather is very nice today".
QUERY BY FORMULA([Comments];
OBJECT Get plain text([Comments]Weather)="@very nice@")
Note In this context, the following statement will not give the desired result
because the text is saved with style tags:
QUERY([Comments];[Comments]Weather="@very nice@")
OBJECT GET RGB OBJECT GET RGB COLORS({*; }object; foregroundColor{; background-
COLORS Color{; altBackgrndColor}})
Parameter Type Description
* * Æ If specified, object is an object
name (string)
If omitted, object is a variable or a
field
object Form object Æ Object name (if * is specified) or
Variable or field (if * is omitted)
foregroundColor Longint Å RGB color value for foreground
backgroundColor Longint Å RGB color value for background
altBackgrndColor Longint Å RGB color value for alternating
background
The new OBJECT GET RGB COLORS command returns the foreground
and background colors of the object or group of objects designated by
object.
If you pass the optional * parameter, you indicate that the object
parameter is an object name (string). If you do not pass this parameter,
you indicate that the object is a field or a variable. In this case, you pass
a field or variable reference (object field or variable only) instead of a
string.
The new OBJECT GET SCROLLBAR command is used to find out the
displayed/hidden status of the horizontal and vertical scrollbars of the
object or group of objects designated by object.
If you pass the optional * parameter, you indicate that the object
parameter is an object name (string). If you do not pass this parameter,
you indicate that the object is a field or a variable. In this case, you pass
a field or variable reference (object field or variable only) instead of a
string.
OBJECT GET SCROLL OBJECT GET SCROLL POSITION({*; }object; vPosition{; hPosition})
POSITION Parameter Type Description
* * Æ If specified, object is an object name
(string)
If omitted, object is a variable, a field or a
table
object Form object Æ Object name (if * is specified) or
Variable or field or table (if * is omitted)
vPosition Longint Å Number of first line displayed or
Vertical scrolling in pixels (pictures)
hPosition Longint Å Number of first column displayed or
Horizontal scrolling in pixels (pictures)
The new OBJECT GET SCROLL POSITION returns, in the vPosition and
hPosition parameters, information related to the position of the scroll
bars of the form object designated by the * and object parameters.
If you pass the optional * parameter, you indicate that the object
parameter is the name of an object of the subform, hierarchical list,
scrollable area, list box or picture type (in this case, pass a string in
object). If you do not pass this parameter, you indicate that the object is
a table (list form or subform table) or a variable (ListRef of hierarchical
list, picture or list box variable) or a field.
If object designates a list type object (subform, list form, hierarchical
list, scrollable area or list box), vPosition returns the number of the first
line displayed in the object. hPosition (list box only) returns the
number of the first column that is completely visible in the left part of
the list box. With other types of objects, this parameter returns 0.
If object designates a picture (variable or field), vPosition returns the
vertical movement and hPosition the horizontal movement of the
picture. These values are expressed in pixels with respect to the origin
of the picture in the local coordinate system.
OBJECT Get styled OBJECT Get styled text({*; }object{; startSel{; endSel}}) Æ Text
text Parameter Type Description
* * Æ If specified, object is an object name
(string)
If omitted, object is a variable or a field
object Form object Æ Object name (if * is specified) or
Variable or field (if * is omitted)
startSel Longint Æ Start of selection
endSel Longint Æ End of selection
The new OBJECT Get styled text command returns the styled text found
in the multi-style text field or variable designated by the object
parameter.
If you pass the optional * parameter, you indicate that the object
parameter is an object name (string). If you do not pass this parameter,
you indicate that the object is a field or a variable. In this case, you pass
a field or variable reference instead of a string.
The command returns the text with any style tags that are associated
with it, which means, for example, that you can copy and paste text
while keeping its style.
If the values of startSel and endSel are equal or if startSel is greater than
endSel, an error is returned.
See Also: OBJECT SET STYLED TEXT, OBJECT Get plain text
OBJECT GET STYLED OBJECT GET STYLED TEXT ATTRIBUTES({*; }object; startSel; endSel; attr-
TEXT ATTRIBUTES Name; attrValue{; attrName2; attrValue2;...;attrNameN; attrValueN})
Parameter Type Description
* * Æ If specified, object is an object name
(string)
If omitted, object is a variable or a field
object Form object Æ Object name (if * is specified) or
Variable or field (if * is omitted)
startSel Number Æ Start of text selection
endSel Number Æ End of text selection
attrName Longint Æ Attribute to get
attrValue Variable Å Current value of attribute
The new OBJECT GET STYLED TEXT ATTRIBUTES command recovers the
current value of a style attribute in a selection of text of the form
object(s) designated by object.
If you pass the optional * parameter, you indicate that the object
parameter is an object name (string). If you do not pass this parameter,
you indicate that the object is a field or a variable. In this case, you pass
a field or variable reference instead of a string.
The startSel and endSel parameters designate the text selection of the
object from which the style attribute is to be read. Pass the position of
the first character of the selection in startSel and the position plus one
of the last character of the selection in endSel.
If the values of startSel and endSel are equal or if startSel is greater than
endSel, an error is returned.
The startSel and endSel values do not take any style tags already present
in the area into account. They are evaluated on the basis of raw text
(text from which style tags have been filtered).
If the value of the attrName attribute is the same for all of the selection,
it is returned in attrValue. If this value is different or if object does not
contain SPAN tags, the following values are returned:
attrValue if attribute heterogenous in
attrName
selection or no SPAN tags
Attribute font name "" (empty string)
Attribute text size 2
Attribute text color FFFFFFFF
Attribute background color FFFFFFFF
Attribute bold style 2
Attribute italic style 2
Attribute underline style 2
Attribute strikethrough 2
style
The new OBJECT Get title command returns the title (label) of the form
object(s) designated by object. This command can only be used with
objects of the ’button’ type displaying text: buttons, check boxes and
radio buttons.
If you pass the optional * parameter, you indicate that the object
parameter is an object name (string). If you do not pass this parameter,
you indicate that the object is a field or a variable. In this case, you pass
a field or variable reference (object field or variable only) instead of a
string.
The new OBJECT Get visible command returns True if the object or
group of objects designated by object has the visible attribute and False
otherwise.
If you pass the optional * parameter, you indicate that the object
parameter is an object name (string). If you do not pass this parameter,
you indicate that the object is a field or a variable. In this case, you pass
a field or variable reference (object field or variable only) instead of a
string.
The new OBJECT SET ENABLED command enables or disables the object
or group of objects specified by object in the current form.
If you pass the optional * parameter, you indicate that the object
parameter is an object name (string). If you do not pass this parameter,
you indicate that the object is a variable. In this case, you pass a
variable reference (object variable only) instead of a string.
Thermometer, Ruler
Note This command has no effect with an object to which a standard action
has been assigned (4D looks after modifying the state of this object
when necessary), except in the case of the Validate and Cancel actions.
min;max;unit;step;flags{;format{;display}}
For rulers, this subparameter can have the following values:
display = 0 (or is omitted): displays a standard ruler.
display = 1: activates "Stepper" mode. For more information, refer to
the “New stepper object” paragraph on page 89.
For thermometers (progress indicators), this subparameter is only
taken into account if the flags subparameter is 128 (undetermined). In
this case:
display = 0 (or is omitted): displays a thermometer in continuous
animation of the "barber shop" type.
display = 1: activates the "Asynchronous progress" mode. For more
information, refer to the “Asynchronous progress indicator”
paragraph on page 90.
OBJECT SET SCROLL OBJECT SET SCROLL POSITION({*; }object{; vPosition{; hPosition}}{; *})
POSITION Parameter Type Description
* * Æ If specified, object is an object name
(string)
If omitted, object is a variable, a field or a
table
object Form object Æ Object name (if * is specified) or
Variable or field or table (if * is omitted)
vPosition Longint Æ Line number to display or
Vertical scrolling in pixels (pictures)
hPosition Longint Æ Column number to display (list box) or
Horizontal scrolling in pixels (pictures)
* * Æ Display of line (and column if the hPosition
parameter is passed) in first position after
scroll
Note The OBJECT SET SCROLL POSITION command was named SCROLL LINES
and was found in the "User Interface" theme in previous versions of 4D.
The scope of the OBJECT SET SCROLL POSITION command has been
extended in 4D v12. In addition to vertical scrolling of subforms, list
forms and list boxes, this command can also cause horizontal scrolling
of list boxes and both vertical and horizontal scrolling of pictures.
Horizontal scrolling of a list box: if object designates a list box, you can
pass a column number in the hPosition parameter. In this case,
executing the command causes horizontal scrolling of the list box so
that this column will be shown. If the column is already visible, the
command does nothing.
As with vertical scrolling, if you pass the second optional * parameter,
the column made visible by the command (if the list box is actually
scrolled) will be placed in the first position.
Note Keep in mind that this command is always based on the "standard"
representation (non-hierarchical) of a list box, even if it is displayed in
hierarchical mode. Consequently, the result of a OBJECT SET SCROLL
POSITION statement may be different depending on whether the list
box is displayed in standard mode or in hierarchical mode.
... the rows and columns of the list box actually scroll:
Normandy Caen 220000 ... ...
Normandy Deauville 4000 ... ...
Normandy Cherbourg 41000 ... ...
... ... ... ... ...
... ... ... ... ...
... ... ... ... ...
... ... ... ... ...
OBJECT SET STYLED OBJECT SET STYLED TEXT({*; }object; newText{; startSel{; endSel}})
TEXT Parameter Type Description
* * Æ If specified, object is an object name
(string)
If omitted, object is a variable or a field
object Form object Æ Object name (if * is specified) or
Variable or field (if * is omitted)
newText String Æ Text to insert
startSel Longint Æ Start of selection
endSel Longint Æ End of selection
The new OBJECT SET STYLED TEXT command inserts the text passed in
the newText parameter into the multi-style text field or variable
designated by the object parameter. This command only applies to the
plain text of the object parameter, without modifying any style tags
that it contains. You can use it to modify, by programming, styled text
displayed on screen.
If you pass the optional * parameter, you indicate that the object
parameter is an object name (string). If you do not pass this parameter,
you indicate that the object is a field or a variable. In this case, you pass
a field or variable reference instead of a string.
If the values of startSel and endSel are equal or if startSel is greater than
endSel, an error is returned.
` You want to replace the styled text selected by the user with the
contents of the vtemp variable:
GET HIGHLIGHT([Products]Notes;vStart;vEnd)
OBJECT SET STYLED TEXT([Products]Notes;vtemp;vStart;vEnd)
See Also: OBJECT Get styled text, OBJECT Get plain text
OBJECT SET STYLED OBJECT SET STYLED TEXT ATTRIBUTES({*; }object; startSel; endSel; attr-
TEXT ATTRIBUTES Name; attrValue{; attrName2; attrValue2;...;attrNameN; attrValueN})
Parameter Type Description
* * Æ If specified, object is an object name
(string)
If omitted, object is a variable or a field
object Form object Æ Object name (if * is specified) or
Variable or field (if * is omitted)
startSel Number Æ Start of new text selection
endSel Number Æ End of new text selection
attrName Longint Æ Attribute to set
attrValue String | Æ New value of attribute
Number
The new OBJECT SET STYLED TEXT ATTRIBUTES command modifies one
or more style attributes in the form object(s) designated by object.
If you pass the optional * parameter, you indicate that the object
parameter is an object name (string). If you do not pass this parameter,
you indicate that the object is a field or a variable. In this case, you pass
a field or variable reference instead of a string.
Note Adding tags increases the size of the string. If you modify the style
attributes of Alpha fields, make sure that the length of the resulting
string does not exceed the maximum field size. Otherwise, the data
will be truncated.
In attrName and attrValue, pass the name and the value, respectively, of
the attribute to be modified. You can pass as many attribute/value pairs
as you want.
The attrValue parameter can be of the Text, Boolean, Integer, Real, Date
or Time type. If you pass invalid attributes or values, 4D returns an
error.
` In this example, we modify the size and color of the text as well as the
bold and underline attributes of the characters 2 to 5 of the field:
OBJECT SET STYLED TEXT ATTRIBUTES([MyTable]MyField;2;5;
Attribute font name;"Arial";Attribute text size; 10;
Attribute underline style; 1; Attribute bold style;
1;Attribute text color;"Blue")
All these modifications are listed in the following table. The new
commands are described afterwards:
New name in 4D v12 Former 4D name
OBJECT Get alignment Get alignment
OBJECT GET BEST SIZE BEST OBJECT SIZE
OBJECT GET COORDINATES GET OBJECT RECT
OBJECT Get format Get format
OBJECT MOVE MOVE OBJECT
OBJECT SET ALIGNMENT SET ALIGNMENT
OBJECT SET CHOICE LIST NAME SET CHOICE LIST
OBJECT SET COLOR SET COLOR
OBJECT SET ENTERABLE SET ENTERABLE
OBJECT SET FILTER SET FILTER
OBJECT SET FONT FONT
OBJECT SET FONT SIZE FONT SIZE
OBJECT SET FONT STYLE FONT STYLE
OBJECT SET FORMAT SET FORMAT
OBJECT SET RBG COLORS SET RGB COLORS
OBJECT SET SCROLLBAR SET SCROLLBAR VISIBLE
OBJECT SET TITLE BUTTON TEXT
OBJECT SET VISIBLE SET VISIBLE
Pasteboard
SET FILE TO SET FILE TO PASTEBOARD(file{; *})
PASTEBOARD Parameter Type Description
file Text Å File name or
Complete pathname of file
* * Æ If passed = add
If omitted = replace
For greater flexibility, you can now pass a file name directly to the SET
FILE TO PASTEBOARD command (without a complete pathname).
PHP
This new theme groups together commands dedicated to the execution
of PHP scripts in 4D (see the “Executing PHP scripts in 4D” paragraph
on page 62).
Note PHP is case sensitive for function names. Do not use parentheses, just
enter the function name only.
The result parameter receives the result of the execution of the PHP
function. You can pass either:
a variable, an array or a field to receive the result,
the * character if the function does not return any result or if you do
not want to retrieve it.
You can pass a variable, an array or a field of the Text, Longint, Real,
Boolean, or Date type as well as (except for arrays) a field of the BLOB
or Time type. 4D will carry out the conversion of the data and any
adjustments needed (for example, for a Real value, the separator will be
chosen according to the system).
If the value returned does not correspond to the type of the result
parameter, 4D will convert it if possible. For example, if you pass a
result variable of the Boolean type and receive a number, result will be
True unless the number is equal to 0. On the other hand, if you pass a
result variable of the number type (Longint or Real) and receive True or
False, result is set to 1 or 0.
Note - If the result is placed in a BLOB, the headers are always kept.
- If the result is placed in a Date, the PHP script must return a date in
the DATE_ATOM format (type "YYYY-MM-DDTHH:MM:SS") and not a
custom or localized format.
The command returns True if the execution has been carried out
correctly on the 4D side, in other words, if the launching of the
execution environment, the opening of the script and the establishing
of the communication with the PHP interpreter were successful.
Otherwise, an error is generated, which you can intercept with the ON
ERR CALL command and analyze with GET LAST ERROR STACK.
In addition, the script itself may generate PHP errors. In this case, you
must use the PHP GET FULL RESPONSE command to analyze the source
of the error (see example 4).
Using environment You can use the SET ENVIRONMENT VARIABLE command to specify the
variables environment variables used by the script. Warning: after calling
LAUNCH EXTERNAL PROCESS or PHP Execute, the set of environment
variables is erased.
Examples
` Example 1: Calling the "myPhpFile.php" script without any function.
Here are the contents of the script:
<?php
echo 'Current PHP version: ' . phpversion();
?>
// Executing script
C_TEXT($T_result)
If(PHP Execute("C:\\MyScripts\\MiscInfos.php";"";$T_result))
// No error, $T_Result contains the result
Else
// An error is detected, managed by PHPErrorHandler
If(phpCommError="")
... // PHP error, use PHP GET FULL RESPONSE
Else
ALERT(phpCommError)
End if
End if
// Uninstalling method
ON ERR CALL ($T_saveErrorHandler)
$strPosition:=Position("function2Rename";$strDoc)
$strDoc:=Insert string($strDoc;"_v2";Length("function2Rename")
+$strPosition)
` Example 6: Direct retrieval of a Date and Time type value. Here are the
contents of the script:
<?php
// . . . code php. . .
echo date(DATE_ATOM, mktime(1, 2, 3, 4, 5, 2009));
// . . . code php. . .
?>
Receiving the date on the 4D side:
C_DATE($phpResult_date)
$result:=PHP Execute("C:\php_scripts\ReturnDate.php";"";
$phpResult_date)
//$phpResult_date is !05/04/2009 !
C_TIME($phpResult_time)
$result:=PHP Execute("C:\php_scripts\ReturnDate.php";"";
$phpResult_time)
PHP GET FULL PHP GET FULL RESPONSE (stdOut{; errLabels; errValues}{; httpHeader-
RESPONSE Fields{; httpHeaderValues}})
Parameter Type Description
stdOut Text/BLOB Å Contents of stdOut buffer
Variable
errLabels Text array Å Labels of errors
errValues Text array Å Values of errors
httpHeaderFields Text array Å Names of HTTP headers
httpHeaderValues Text array Å Values of HTTP headers
The PHP GET FULL RESPONSE command lets you obtain additional
information about the response returned by the PHP interpreter. This
command is particularly useful in the case of an error occurring during
execution of the script.
The PHP script can write data in the stdOut buffer (echo, print, etc.).
This data can be recovered in the stdOut variable.
The synchronized errLabels and errValues text arrays are filled when the
execution of the PHP scripts causes errors. These arrays provide
information in particular on the error origin, script and line. These two
arrays are inseparable: if errLabels is passed, errValues must be passed as
well.
Since exchanges between 4D and the PHP interpreter are carried out
via FastCGI, the PHP interpreter functions as if it were called by an
HTTP server and therefore sends HTTP headers. You can recover these
headers and their values in the httpHeaderFields and httpHeaderValues
arrays.
The PHP GET OPTION command can be used to find out the current
value of an option relating to the execution of PHP scripts.
The PHP SET OPTION command sets specific options before calling the
PHP Execute command. The scope of this command is the current
process.
By default, PHP SET OPTION sets the option for all subsequent calls to
PHP Execute of the process. If you want to set it for the next call only,
pass the star (*) parameter.
Pictures
This theme contains several new commands used to test picture files (Is
picture file) and work with metadata (SET PICTURE METADATA and GET
PICTURE METADATA). The CONVERT PICTURE and PICTURE CODEC LIST
commands accept additional parameters and three obsolete commands
have been renamed.
New APIs for 4D v12 uses new native APIs to encode and decode pictures (fields and
encoding and variables) under Windows and Mac OS. These implementations
decoding pictures provide access to additional native formats, including the RAW format,
which is currently used for digital cameras.
Under Windows, 4D now uses WIC (Windows Imaging Component).
WIC natively supports the following formats: BMP, PNG, ICO
(decoding only), JPEG, GIF, TIFF and WDP (Microsoft Windows Digital
Photo).
It is possible to use additional formats such as JPEG-2000 by installing
third-party WIC codecs.
Under Mac OS, 4D now uses ImageIO. All the available ImageIO codecs
are therefore supported natively for decoding (reading) as well as
encoding (writing):
Decoding Encoding
public.jpeg public.jpeg
com.compuserve.gif com.compuserve.gif
public.png public.png
public.jpeg-2000 public.jpeg-2000
com.nikon.raw-image public.tiff
com.pentax.raw-image com.adobe.photoshop.image
com.sony.arw-raw-image com.adobe.pdf
com.adobe.raw-image com.microsoft.bmp
public.tiff com.canon.crw-raw-image com.truevision.tga-image
com.canon.cr2-raw-image com.sgi.sgi-image
com.canon.tif-raw-image com.apple.pict
com.sony.raw.image com.ilm.openexr-image
com.olympus.raw-image
com.konicaminolta.raw-image
com.panasonic.raw-image
com.fuji.raw-image
com.adobe.photoshop-image
com.adobe.illustrator.ai-image
com.adobe.pdf
com.microsoft.ico
com.microsoft.bmp
com.truevision.tga-image
com.sgi.sgi-image
com.apple.quicktime-image
com.apple.icns
com.apple.pict
com.apple.macpaint-image
com.kodak.flashpix-image
public.xbitmap-image
com.ilm.openexr-image
public.radiance
Under Windows as under Mac OS, the formats supported will vary
according to the operating system and the custom Codecs installed on
the machines. To find out which Codecs are available, you will need to
use the PICTURE CODEC LIST command.
Note that WIC and ImageIO allow the use of metadata in pictures. Two
new commands, SET PICTURE METADATA and GET PICTURE METADATA
have been added so that you can benefit from metadata in your
development projects.
Note For more information about picture management APIs in 4D v12, refer
to the “New APIs for encoding and decoding pictures” paragraph on
page 191.
GET PICTURE GET PICTURE METADATA (picture; metaName1; contents1{ ;...; metaNa-
METADATA meN; contentsN})
Parameter Type Description
picture Picture Æ Picture whose metadata you want to
get
metaName1...N Text Æ Name or path of block to get
contents1...N Variable Å Metadata contents
The new GET PICTURE METADATA command reads the contents of the
metadata (or meta-tags) found in picture (4D picture field or variable).
For more information about metadata, refer to the description of the
SET PICTURE METADATA command.
Note Since they are numerous, the constants of the new "Picture metadata
names" and "Picture metadata values" themes are described in the
appendix C, “Metadata Constants,” on page 337.
` Using variables:
C_DATE($dateAsDate)
GET PICTURE METADATA("TIFF/DateTime";$dateAsDate)
//only returns the date since $dateAsDate is of the Date type
C_TEXT($dateAsText)
GET PICTURE METADATA("TIFF/DateTime";$dateAsText)
//only returns the date but in XML format
C_INTEGER($urgency)
GET PICTURE METADATA(vPicture;"IPTC/Urgency";$urgency)
The new Is picture file command tests the file designated by the filePath
parameter and returns True if it is a valid picture file. The command
returns False if the file is not of the picture type or if it is not found.
If you do not pass the * parameter, the command tests the file by
looking for its extension among the list of available codecs. If you want
to be able to test files without extensions or to carry out a more
thorough verification, pass the * parameter. In this case, the command
makes additional tests: it loads and inspects the file header and queries
the codecs in order to validate the picture. This syntax slows command
execution.
Note The command returns True for PDF files under Windows and EMF files
under Mac OS.
The PICTURE CODEC LIST command now allows you to recover the list
of Codecs used to decode (read) pictures. To do this, simply pass the
new optional * parameter. By default, when this parameter is omitted,
the command returns the Codecs that can be used to encode (write)
pictures.
The two lists are not exclusive, certain reading and writing Codecs are
identical. Codecs intended for encoding pictures may usually be used
for decoding. On the other hand, decoding Codecs cannot necessarily
be used for encoding. For example, the ".jpg" Codec will be found in
both lists, whereas the ".xbmp" Codec will only be found in the list of
reading (decoding) Codecs.
SET PICTURE SET PICTURE METADATA (picture; metaName1; contents1{ ;...; metaNa-
METADATA meN; contentsN})
Parameter Type Description
picture Picture Æ Picture whose metadata you want to
set
metaName1...N Text Æ Name or path of block to set
contents1...N Variable Æ Metadata contents
Note For a detailed description of these metadata types, you can consult the
following documents:
http://www.iptc.org/std/IIM/4.1/specification/IIMV4.1.pdf (IPTC) and
http://exif.org/Exif2-2.PDF (TIFF, EXIF and GPS).
Note Since they are numerous, the constants of the new "Picture metadata
names" and "Picture metadata values" themes are described in
appendix C, “Metadata Constants,” on page 337.
Note When all the metadata are handled via a DOM element reference, the
tags are stored as attributes attached to an element (a child of the
referenced element) whose name is the block name (TIFF, IPTC, etc.).
When a specific metadata block is manipulated, the block tags are
stored as attributes that are directly attached to the element referenced
by the command.
From now on, if you omit the codec parameter, the command will
attempt to determine the codec based on the extension of the file
name passed in the fileName parameter. For example, if you pass the
statement:
WRITE PICTURE FILE ("c:\folder\photo.jpg";myphoto)
... the command will use the JPEG codec to store the picture.
If the extension used does not correspond to any available codec, the
file is not saved and the OK system variable is set to 0. If you do not
pass a codec or a file extension, the picture file is saved in PICT format.
Renamed In 4D v12, three command of the "Pictures" theme have been prefixed
commands with "QT" to indicate that they are based on the Apple QuickTime
extension and are obsolete:
New name in 4D v12 Former name
QT COMPRESS PICTURE COMPRESS PICTURE
QT LOAD COMPRESS PICTURE FROM LOAD COMPRESS PICTURE FROM
FILE FILE
QT COMPRESS PICTURE FILE COMPRESS PICTURE FILE
These command must no longer be used in 4D v12. They are kept for
compatibility reasons only.
Printing
The printing function has been strengthened along two main lines in
4D v12:
For more customization, the new OPEN PRINTING FORM and Print
object command complete the set of tools that manage the printing of
form objects,
The integration of the OpenSource PDFCreator driver and its support
via the SET PRINT OPTION and GET PRINT OPTION commands
facilitates the PDF printing under Windows.
The new OPEN PRINTING FORM command loads the project form form
for printing. Once loaded, this form becomes the current printing
form. All the object management commands, and in particular the
new Print object command, work with this form.
Only the "On Load" form event is executed during the opening of the
project form. The other form events are ignored. The "On Unload"
form event is executed at the end of printing.
The new Print object command prints the form object(s) designated by
the object and * parameters, at the location set by the posX and posY
parameters.
The Print object command can only print project form objects. Before
calling this command, you must designate the project form containing
the objects to be printed using the new OPEN PRINTING FORM
command.
If you pass the optional * parameter, you indicate that the object
parameter is an object name (character string). If you do not pass the *
parameter, you indicate that object is a variable. In this case, you pass a
variable reference (object type only) instead of a string.
The posX and posY parameters specify the starting point for printing
the object(s). These values must be expressed in pixels. If these
parameters are omitted, the object will be printed according to its
location in the form.
The width and height parameters specify the width and height of the
form object. The Print object command does not manage objects of
variable size. You must use the OBJECT GET BEST SIZE command to
manage the size of objects. You can also use the OBJECT GET BEST SIZE
command to find out the most appropriate size for objects containing
text. Similarly, Print object will not cause automatic page breaks. You
must manage them according to your needs.
The command returns True if the object has been completely printed
and False if this is not the case, in other words if it was not able to print
all the data associated with the object within the set framework.
Typically, the command returns False when printing a list box if all the
rows of the list box could not be printed. In this case, you can simply
call the Print object command repeatedly until it returns True: a specific
mechanism automatically causes the contents of the object to scroll
after each call.
Notes - In the current version of 4D v12, only list box type objects have this
mechanism (the command always returns True for any other type of
object). In forthcoming versions of 4D, this functioning will be
extended to other objects with variable contents.
- The LISTBOX GET PRINT INFORMATION command lets you check the
status of the printing during the operation. For more information, refer
to the “Printing list boxes” paragraph on page 116.
The Print object command can only be used in the context of a print
job opened beforehand with the OPEN PRINTING JOB command. If it is
not called in this context, the command does nothing. Several Print
object commands can be called in the same print job.
For ($i;1;10)
OBJECT GET BEST SIZE(*;"Obj"+String($i);bestwidth;bestheight)
$end:=Print object(*;"Obj"+String($i))
y:=y+bestheight+15
If (y>hpaper)
PAGE BREAK(>)
y:=50
End if
End for
End if
CLOSE PRINTING JOB
End if
Integration of The support of PDF printing under Windows has been extended in 4D
PDFCreator driver v12. The program relies on the PDFCreator driver to offer simple and
under Windows functional PDF printing functions. The SET PRINT OPTION and GET
PRINT OPTION commands have been modified to be able to use this
driver.
Note Under Mac OS, PDF printing is supported natively by the system.
The GET PRINT OPTION command now accepts a string in the option
parameter. This modification allows the command to manage the
PDFCreator driver options. For more information about this new
features, refer to the description of the SET PRINT OPTION command.
The option parameter now accepts a Text type value in which you can
pass a PDF option code. The option code consists of two parts:
OptionType and OptionName, combined as "OptionType:OptionName".
Here is the description of this code:
OptionType: Indicates whether you are specifying a native PDFCreator
option or a 4D PDF administration option. Two values are accepted:
PDFOptions = native option
PDFInfo = internal option.
OptionName: Specifies the option to be set (depending on the
OptionType value).
If OptionType = PDFOptions, you can pass one of several PDFCreator
native options in OptionName. For example, the UseAutosave
option affects the automatic backup. To be able to modify this
option, pass "PDFOptions:UseAutosave" in the option parameter and
the value to be used in the value1 parameter. For a complete
description of the PDFCreator native options, refer to the
documentation provided with the PDFCreator driver.
If OptionType = PDFInfo, you can pass one of the following specific
selectors in OptionName:
- Reset print: resets the internal waiting status in order, more
particularly, to exit from an infinite loop.
In this case, value1 is not used.
- Reset standard options: resets all the PDFCreator options to their
default values. If printing is in progress, the default settings are
applied after its completion. In this case, value1 is not used.
` The following method configures the PDF driver to print all the
records of the table in the C:\test\Test_PDF_X file where X is the
sequence number of the record:
SET CURRENT PRINTER(PDFCreator Printer name)
// Use the virtual printer installed by PDFCreator
SET PRINT OPTION ("PDFOptions:UseAutosave";1)
SET PRINT OPTION("PDFOptions:UseAutosaveDirectory";1)
SET PRINT OPTION("PDFOptions:AutosaveDirectory";"C:\\test\\")
ALL RECORDS([Table_1])
For ($i;1;Records in selection([Table_1]))
SET PRINT OPTION("PDFOptions:AutosaveFilename";
"Test_PDF_"+String($i))
PRINT RECORD([Table_1];*)
NEXT RECORD([Table_1])
End for
SET PRINT OPTION("PDFInfo:Reset standard options";0)
// Resetting the PDFCreator driver options
SQL
Three new SQL commands can be used to export the data of the 4D
database and to execute SQL scripts.
Note that the new features relating to the SQL engine of 4D are
described in Chapter 6, “SQL,” on page 295.
Pass the complete pathname of the text file containing the SQL
statements to be executed in the scriptPath parameter. The pathname
must be expressed using the syntax of the current system. If you pass
an empty string ("") in scriptPath, a standard Open document dialog
box appears and the user can select the script file to be executed.
Note The new SQL EXPORT DATABASE and SQL EXPORT SELECTION
commands automatically generate this script file.
The new SQL EXPORT DATABASE command exports in SQL format all
the records of all the tables in the open database. In SQL, this global
export operation is called "Dump".
Note This command cannot be used with an external connection that has
been opened directly or via ODBC.
For each exported table, the command carries out the following
actions:
A subfolder with the table name is created in the destination folder.
If you pass the numFiles parameter, the command will create as many
"BlobsX" subfolders as necessary so that each one of them does not
contain more than numFiles BLOB, picture or external text files. By
default, if the numFiles parameter is omitted, the command limits the
number of files to 200. If you pass 0, each subfolder will contain at
least one file.
The fileLimitSize parameter sets a size limit (in bytes) for each
"Export.sql" created on disk. Once the size of the export file being
created reaches the value set in fileLimitSize, 4D stops writing records,
closes the file and creates a new file named "ExportX.sql" (where X
represents the sequence number) next to the previous one. Note that
with this mechanism, the actual size of the "ExportX.sql" files exceeds
the value set by fileLimitSize because the file is only closed after the
record that was being exported when the limit was reached has been
completely written. The minimum size accepted is 100 KB and the
maximum size is 10 MB.
In the export file, there may be fewer values than there are fields in the
table. In this case, the empty fields will be considered as NULL. You
can also pass the NULL value in a field.
If the export has been carried out correctly, the OK variable is set to 1.
Otherwise, it is set to 0.
The new SQL EXPORT SELECTION command exports in SQL format the
records of the current selection of the 4D table designated by the
aTable parameter.
Note This command cannot be used with an external connection that has
been opened directly or via ODBC.
String
Convert to text Convert to text(BLOB ; charSet) Æ Text
The Convert to text command now supports BOMs (Byte Order Marks).
Structure Access
Two new utility commands have been added to this theme, which
allow the recovery of any "phantom" data of the database.
The new GET MISSING TABLE NAMES command returns the names of
all the missing tables of the current database in the missingTables array.
Missing tables are tables whose data are present in the data file but that
do not exist at the level of the current structure. This can happen when
a data file is opened with different versions of the structure.
The user adds the custom tables D and E, using, for example, the
integrated SQL commands of 4D, and stores data in these tables,
The developer provides a new version of the structure. It does not
contain tables D and E.
In this case, the user version of the database still contains data from
tables D and E, but it cannot be accessed. The GET MISSING TABLE
NAMES command will return the names "D" and "E".
Once you have identified the missing tables of the database, you can
reactivate them via the new REGENERATE MISSING TABLE command.
Note The data of missing tables are erased when the data file is compacted
(if the tables have not been regenerated).
Missing tables are tables whose data are present in the data file but that
do not exist at the structure level. You can identify any missing tables
that may be present in the application by using the new GET MISSING
TABLE NAMES command.
` This method regenerates all the missing tables that may be present in
the database:
ARRAY TEXT($arrMissingTables;0)
GET MISSING TABLE NAMES($arrMissingTables)
$SizeArray:=Size of array($arrMissingTables)
If ($SizeArray#0)
// Fills the array with the names of all the tables in the database
ARRAY TEXT(arrTables;Get last table number)
If (Get last table number>0) //If there are actually tables
For ($vlTables;Size of array(arrTables);1;-1)
If (Is table number valid($vlTables))
arrTables{$vlTables}:=Table name($vlTables)
Else
DELETE FROM ARRAY(arrTables;$vlTables)
End if
End for
End if
For ($i;1;$SizeArray)
If (Find in array(arrTables;$arrMissingTables{$i})=-1)
CONFIRM("Regenerate the table"+$arrMissingTables{$i}+"?")
If (OK=1)
REGENERATE MISSING TABLE($arrMissingTables{$i})
End if
Else
ALERT("Impossible to regenerate table "+$arrMissingTables{$i}+
" because there is already a table with this name in the database.")
End if
End for
Else
ALERT("No tables to regenerate.")
End if
SVG
The new "SVG" theme groups together all the SVG commands of 4D
v12. In previous versions of 4D, these commands were placed in the
"XML Utilities" theme.
Four new SVG commands make their appearance in 4D v12: SVG SET
ATTRIBUTE, SVG GET ATTRIBUTE, SVG Find element ID by rect, SVG SHOW
ELEMENT.
Note on the SVG The SVG rendering engine has been updated in 4D v12. In addition to
rendering engine the new commands described below, many new elements and
attributes of elements are now supported, such as "pattern" or
"CoreText". The SVG component of 4D takes advantage of these new
features.
SVG Find element ID SVG Find element ID by rect ({*; }pictureObject; x; y; width; height; arrIDs)
by rect Æ Boolean
Parameter Type Description
* * Æ If specified, pictureObject is an
object name (string)
If omitted, pictureObject is a varia-
ble
pictureObject Picture Æ Object name (if * specified) or
Field or variable (if * omitted)
x Longint Æ Horizontal coordinate of top left
corner of selection rectangle
y Longint Æ Vertical coordinate of top left cor-
ner of selection rectangle
width Longint Æ Width of selection rectangle
height Longint Æ Height of selection rectangle
arrIDs String array Å IDs of elements whose bounding
rectangle intersects with the selec-
tion rectangle
The new SVG Find element ID by rect command fills the Text or Alpha
arrIDs array with the IDs ("id" or "xml:id" attribute) of the XML
elements whose bounding rectangle intersects with the selection
rectangle at the location specified by the x and y parameters.
The command returns True if at least one element is found (in other
words if the arrIDs array is not empty), and False otherwise.
If you pass the optional * parameter, you indicate that the pictureObject
parameter is an object name (string). If you do not pass this parameter,
you indicate that the pictureObject is a field or a variable. In this case,
you pass a field or variable reference (object field or variable only)
instead of a string.
Note In the system of picture coordinates, [x;y] always specifies the same
point, regardless of the picture display format, apart from the
"Replicated" format.
SVG GET ATTRIBUTE SVG GET ATTRIBUTE({*; }pictureObject; element_ID; attrName; attrValue)
Parameter Type Description
* * Æ If specified, pictureObject is an
object name (string)
If omitted, pictureObject is a varia-
ble
pictureObject Picture Æ Object name (if * specified) or
Variable (if * omitted)
element_ID String Æ ID of element whose attribute value
you want to get
attrName String Æ Attribute whose value you want to
get
attrValue String | Value Å Current value of attribute
The new SVG GET ATTRIBUTE command retrieves the current value of
the attrName attribute in an object or an SVG picture.
If you pass the optional * parameter, you indicate that the pictureObject
parameter is an object name (string). In this case, the command
returns the value of the attribute for the rendered image attached to
the object. This value may have been modified by SVG SET ATTRIBUTE
for example.
If you do not pass the * parameter, you indicate that the pictureObject
parameter is a variable. Therefore, you pass a variable reference (object
variable only) instead of a string. In this case, the command returns
the value of the attribute for the initial rendered image (corresponding
to the data source of the variable).
Note This principle also applies to the existing SVG Find element ID by
coordinates command.
SVG SET ATTRIBUTE SVG SET ATTRIBUTE({*; }pictureObject; element_ID; attrName; attrValue{;
attrName2; attrValue2; ...; attrNameN; attrValueN})
Parameter Type Description
* * Æ If specified, pictureObject is an
object name (string)
If omitted, pictureObject is a varia-
ble
pictureObject Picture Æ Object name (if * specified) or
Variable or Field (if * omitted)
element_ID String Æ ID of element where one or more
attributes are set
attrName String Æ Attribute to be specified
attrValue String | Value Æ New value of attribute
If you pass the optional * parameter, you indicate that the pictureObject
parameter is an object name (string). In this case, the command
applies to the parameters of the rendered image attached to the object
(note that the parameters and therefore the rendered image of the
object are only created if the SVG SET ATTRIBUTE command is called at
least once).
If you do not pass the * parameter, you indicate that the pictureObject
parameter is a variable or a field. Therefore, you pass a variable (object
variable only) or field reference instead of a string. In this case, the
command applies to the rendered images of all the objects that use the
variable (but not to the initial rendered image).
The SVG SET ATTRIBUTE command is used to modify (but not to add or
delete) most of the SVG attributes, such as, for instance, 'fill', 'opacity',
'font-family', and so on. For a complete definition of the SVG
attributes, refer to the reference documents available on the Internet,
for example http://www.w3.org/TR/SVG11/attindex.html. The rendered
image is updated immediately; the modifications are transferred on to
the child elements for inherited styles.
Note There is no namespace so that the attribute could be used in a CSS style
sheet without risk of conflict.
The new SVG SHOW ELEMENT command moves the pictureObject SVG
document in order to show the element whose "id" attribute is
specified by the id parameter.
If you pass the optional * parameter, you indicate that the pictureObject
parameter is an object name (string). In this case, the command
applies to the rendered picture attached to the object. If you do not
pass this parameter, you indicate that pictureObject is a field or a
variable and you pass a variable (object variable only) or a field
reference instead of a string. In this case, the command applies to the
rendered pictures of all the objects that use the variable (but not the
initial rendered picture).
The command moves the SVG document so that all of the object,
whose limits are defined by its bounding rectangle, is visible. The
margin parameter configures the amplitude of the movement by
specifying the distance that must separate the object displayed from
the borders of the document. In other words, the bounding rectangle
will be increased by margin pixels in width and in height. By default,
the movement value is 4 pixels.
This command only takes effect in "top left" display mode (with
scrollbars).
System Documents
The management of documents within a multi-language interface
based on XLIFF architecture has been extended in 4D v12. A new
command can be used to retrieve the pathname of any document
integrated in this architecture according to the current language. In
addition, two new commands facilitate the conversion of system and
POSIX pathnames. A new parameter has been added to the Select folder
command in order to benefit from additional options.
Note It is now possible to specify the current language of the database using
the new SET DATABASE LOCALIZATION command, located in the "4D
Environment" theme.
4D Server In remote mode, the command returns the path of the Resources folder
on the client machine if the command is called from a client process.
4D looks for the file while respecting a sequence that allows all the
cases of multi-language applications to be processed. At each step, 4D
checks for the presence of relativePath in the folder corresponding to
the language and returns the complete path when it succeeds. If
relativePath is not found or if the folder does not exist, 4D passes to the
next step. Here are the folders for each of the different search stages:
Current language (e.g.: fr-ca)
Current language without region (e.g.: fr)
Language loaded by default on startup (e.g.: es-ga)
Language loaded by default on startup without region (e.g.: es)
First .lproj folder found (e.g.: en.lproj)
First level of Resources folder
` For the purpose of transforming an XML or HTML file, you want to use
a "log.xsl" transformation file. This file differs depending on the
current language. You therefore want to know which "log.xsl" file path
to use.
Here are the contents of the Resources folder:
To use a .xsl file adapted to the current language, you simply need to
pass:
$myxsl:=Get localized document path ("xsl/log.xsl")
If the current language is, for example, French Canadian (fr-ca), the
command returns:
Under Windows:
C:\users\…\…\…\resources\fr_ca.lproj\xsl\log.xsl"
Under Mac OS:
"HardDisk:users:…:…:…:resources:fr_ca.lproj:xsl:log.xsl"
The Select folder command now accepts the options parameter. This
parameter lets you benefit from additional functions under Mac OS.
In options, you can pass one of the following predefined constants,
located in the "System Documents" theme:
Package open (2): Allows the opening of packages as folders and thus
the display/selection of their contents. By default, if this constant is
not used, the command does not allow the opening of packages.
Use Sheet Window (16): Displays the selection dialog box as a sheet
window. Sheet windows are specific to the Mac OS X interface and
benefit more particularly from a graphic animation. By default, if this
constant is not used, the command displays a standard dialog box.
These options are only taken into account under Mac OS. Under
Windows, the options parameters is ignored if it is passed.
Tools
Several modifications have been made in the "Tools" theme of 4D v12:
A new command has been added that generates UUID identifiers,
C_TEXT($base64Text)
C_BLOB($targetBlob)
BASE64 DECODE($base64Text;$targetBlob) //Decoding of text
// the binary encoded in base 64 is now available as a BLOB in $blobTarget
SET ENVIRONMENT The SET ENVIRONMENT VARIABLE command now functions with the
VARIABLE PHP Execute command.
User Interface
This theme receives the new OBJECT Get name and OBJECT Get pointer
commands. The HIGHLIGHT TEXT and GET HIGHLIGHT commands now
accept an "object" syntax. The SCROLL LINES command has been
renamed OBJECT SET SCROLL POSITION and transferred to the "Object
Properties" theme.
If you pass the optional * parameter, you indicate that the object
parameter is an object name (character string). If you do not pass the *
parameter, you indicate that object is a field or variable. In this case,
you pass the field or variable reference (form fields or variables only)
instead of a string.
` This new syntax facilitates the use of the new OBJECT SET STYLED TEXT
ATTRIBUTES command:
GET HIGHLIGHT(*;"myText";$startsel,$endsel)
OBJECT SET STYLED TEXT ATTRIBUTE(*;"myText";$startsel,$endsel;
Attribute underline style; 1; Attribute bold style;1)
If you pass the optional * parameter, you indicate that the object
parameter is an object name (character string). If you do not pass the *
parameter, you indicate that object is a field or variable. In this case,
you pass the field or variable reference (form fields or variables only)
instead of a string.
The new OBJECT Get name command returns the name of a form
object.
OBJECT Get pointer OBJECT Get pointer {(selector{; objectName{; subformName}})} Æ Pointer
Parameter Type Description
selector Longint Æ Object category
objectName Text Æ Object name
subformName Text Æ Subform object name
Object with focus: If you pass this selector, the command returns a
pointer to the variable associated with the object that has the focus
in the form. The last two optional parameters are ignored if they are
passed.
` Given a form "SF" used twice as a subform in the same parent form.
The subform objects are named "SF1" and "SF2". The "SF" form contains
an object named CurrentValue. In the "On Load" form event of the form
method of the parent form, we want to initialize the CurrentValue
object of SF1 to "January" and that of SF2 to "February":
C_POINTER($Ptr)
$Ptr:=OBJECT Get pointer(Object named;"CurrentValue";"SF1")
$Ptr->:="January"
$Ptr:=OBJECT Get pointer(Object named;"CurrentValue";"SF2")
$Ptr->:="February"
Web Server
PROCESS HTML The PROCESS HTML TAGS command is optimized in 4D v12. The
TAGS processing performed by this command is now completely decoupled
from the Web server settings. In particular, when you use BLOB type
parameters, the command no longer takes the character set specified
for the Web server into account. For the sake of compatibility, it
considers that the character set used for BLOBs is MacRoman.
For better efficiency, it is not strongly recommended to use Text type
parameters. In this case, processing will automatically be carried out in
Unicode.
XML
Note The "XML" theme replaces the "XML Utilities" theme of previous
versions of 4D. It now groups together the generic XML commands
that apply to both DOM and SAX commands, as well as the XSLT and
SVG commands.
Note on use of XML XML structures are based on data of the Text type. However, the 4D
BLOBs in 4D v12 XML commands (for example DOM Parse XML variable) usually accept
parameters of the BLOB type for handling XML data, regardless of their
original type. This possibility was necessary in previous versions of 4D
where the size of Text type variables was limited to 32 KB.
Beginning with 4D v11, variables and fields of the Text type can
contain up to 2 GB of data. It is now highly inadvisable to store texts
in BLOBs. The use of BLOBs should be reserved for processing binary
data. For better conformity with XML specifications, in 4D v12 binary
data are automatically encoded in Base64, even if the BLOB contains
text.
Note The ENCODE and DECODE commands (renamed The SET
ENVIRONMENT VARIABLE command now functions with the PHP Execute
command. and BASE64 DECODE) can now handle Text type parameters.
These commands are useful in the framework of encoding XML data.
These commands are included in the "Tools" theme (see the “Tools”
paragraph on page 228).
Repeat
MyEvent:=SAX Get XML node(DocRef)
Case of
: (MyEvent=XML Start Element)
ARRAY TEXT(arrAttribNames;0)
ARRAY TEXT(arrAttribValues;0)
SAX GET XML ELEMENT (DocRef;vName;vPrefix;arrAttribNames;ar-
rAttribValues)
If (vName="CD")
CREATE RECORD([CD])
For ($i;1;Size of array(arrAttribNames))
$attrName:=arrAttribNames{$i}
Case of
: ($attrName="CD_ID")
XML DECODE(arrAttribValues{$i};[CD]CD_ID)
: ($attrName="Title")
[CD]Work:=arrAttribValues{$i}
: ($attrName="Price")
XML DECODE(arrAttribValues{$i};[CD]Price)
: ($attrName="Date")
XML DECODE(arrAttribValues{$i};[CD]Date entered)
: ($attrName="Duration")
XML DECODE(arrAttribValues{$i};[CD]Total_duration)
: ($attrName="Double")
XML DECODE(arrAttribValues{$i};[CD]Double_CD)
End case
End for
End if
...
End case
Until (MyEvent=XML Start Document)
XML GET OPTIONS XML GET OPTIONS(elementRef | document; selector; value{; selector2;
value2;...;selectorN; valueN})
Parameter Type Description
elementRef | String | Æ XML root element reference or
document DocRef Reference of open document
selector1...N Integer Æ Option to get
value1...N Integer Å Current value of option
The new XML GET OPTIONS command retrieves the current value of
one or more XML parameters for the current session and the current
user.
XML SET OPTIONS XML SET OPTIONS(elementRef | document; selector; value{; selector2;
value2;...;selectorN; valueN})
Parameter Type Description
elementRef | String | Æ XML root element reference or
document DocRef Reference of open document
selector1...N Integer Æ Option to set
value1...N Integer Æ Value of option
The new XML SET OPTIONS command modifies the value of one or
more XML parameters for the current session and current user.
This command applies the XML structures of the "tree" type (DOM) or
of the "document" type (SAX). In the first parameter, you can pass
either a root element reference (elementRef), or the reference of an open
SAX document (document).
The options set by this command are only used in the direction 4D to
XML (it has no effect on the reading of XML values in 4D. The
following commands use these options:
DOM SET XML ELEMENT VALUE
Pass the option to be modified in selector and the new value of the
option in value. You can pass as many selector/value pairs as you want.
You must use the constants described below, placed in the "XML"
theme:
selector = XML String encoding(1)
This selector specifies the way 4D strings are converted to element
values. It does not concern the conversion to attributes for which XML
imposes the use of escape characters.
value = XML With escaping(1) (default value): conversion of 4D
strings to XML element values with replacement of characters. The
Text type data are automatically parsed so that forbidden characters
(<&>’) are replaced by XML entities (&<> '").
value = XML Raw data(2): 4D strings are sent as raw data; 4D does
not carry out encoding or parsing. 4D values are converted if
possible to XML fragments and inserted as a child of the target
element. If a value cannot be considered as an XML fragment, it is
inserted as raw data into a new CDATA node.
selector = XML Date encoding(2)
This selector specifies the way 4D dates will be converted. For example,
!01/01/2003! in the Paris time zone.
value = XML ISO (1) (default value): uses the format xs:datetime
without indication of time zone. Result: "2003-01-01". The time
part, if it is present in the 4D value (via SQL) is lost.
value = XML Local (2): uses the format xs:date with indication of
time zone. Result: "2003-01-01 +01:00". The time part, if it is present
in the 4D value (via SQL) is lost.
value = XML Datetime local (3): uses the format xs:dateTime (ISO
8601). Indication of time zone. This format allows the time part to
be kept, if it is present in the 4D value (via SQL). Result:
"<Date>2003-01-01T00:00:00 +01:00</Date>".
value = XML UTC (4): uses the format xs:date. Result: "2003-01-01Z".
The time part, if it is present in the 4D value (via SQL) is lost.
value = XML Datetime UTC (5): uses the format xs:dateTime (ISO
8601). This format allows the time part to be kept, if it is present in
the 4D value (via SQL). Result: "<Date>2003-01-
01T00:00:00Z</Date>".
Note The XML Local and XML Datetime local values do not provide dates
expressed in UTC (Universal Time Coordinated); they are converted
without modification but indicating the time difference. These formats
are useful in the case of successive and reciprocal conversions (round
tripping).
The XML UTC and XML Datetime UTC values are equivalent to the
previous ones from the formatting viewpoint, but they are expressed in
UTC. These formats should be given priority to ensure interoperability.
The values are not modified.
XML DOM
Several new commands have been added to the XML DOM theme:
DOM Create XML element arrays, DOM REMOVE XML ATTRIBUTE, DOM
Insert XML element, DOM Append XML element, DOM Append XML child
node, DOM GET XML CHILD NODES, DOM Get XML document ref.
Furthermore, due to the implementation of the XML SET OPTIONS and
XML GET OPTIONS commands, the existing DOM SET XML OPTIONS
command has been renamed DOM SET XML DECLARATION and its
functioning has been adapted.
DOM Append XML DOM Append XML child node (elementRef; childType; childValue) Æ
child node String
Parameter Type Description
elementRef String Æ XML element reference
childType Longint Æ Type of child to append
childValue String | BLOB Æ Text or variable (Text or BLOB) whose
value must be inserted as child node
The new DOM Append XML child node command appends the
childValue value to the XML node designated by elementRef.
Note If the elementRef parameter designates the Document node (top level
node), the command inserts a "Doctype" node before any other node.
The same goes for processing instructions and comments, which are
always inserted before the root node (but after the Doctype node).
Result:
<myElement>Hello<br/>New<br/>York</myElement>
` Adding a processing instruction type node:
$Txt_instruction:="xml-stylesheet type = \"text/xsl\" href=\"style.xsl\""
Reference:= DOM Append XML child node(elementRef;XML Processing
Instruction ; $Txt_instruction )
Result:
<!--Hello world-->
` Adding a CDATA type node:
Reference:= DOM Append XML child node (elementRef; XML CDATA;
"12 < 18")
Result:
<element><![CDATA[12 < 18]]></element>
Result:
<parent>
<child>simon</child>
<child>eva</child>
</parent>
Result:
<parent>
<tbreak/>
</parent>
If the contents of childValue are not valid, an error is returned.
The new DOM Append XML element command adds a new XML
element to the children of the XML element whose reference is passed
in the targetElementRef parameter.
DOM Create XML DOM Create XML element arrays (elementRef; xPath{; attrNamesArray;
element arrays attrValuesArray}{; attrNamesArray2; attrValuesArray2; ...; attrNamesArrayN;
attrValuesArrayN}) Æ String
Parameter Type Description
elementRef String Æ XML root element reference
xPath Text Æ XPath path of the XML element to
create
attrNamesArray Array Æ Array of attribute names
attrValuesArray Array Æ Array of attribute values
The new DOM Create XML element arrays command adds a new
element in the elementRef XML element, as well as, optionally,
attributes and their values in the form of arrays.
Optionally, the DOM Create XML element arrays command can be used
to pass several pairs of attributes and attribute values as arrays in the
attrNamesArray and attrValuesArray parameters. In attrValuesArray, you
can pass arrays of the text, date, number, and picture type. 4D
automatically carries out the necessary conversions; you can modify
these conversions using the new XML SET OPTIONS command.
The arrays must have been created beforehand and function by pairs.
You can pass as many pairs of arrays and as many elements in each pair
as you want.
DOM GET XML DOM GET XML CHILD NODES(elementRef; childTypesArr; nodeRefsArr)
CHILD NODES Parameter Type Description
elementRef String Æ XML element reference
childTypesArr Longint array Å Types of child nodes
nodeRefsArr Text array Å References or Values of child
nodes
The new DOM GET XML CHILD NODES command returns the types and
references or values of all the child nodes of the XML element
designated by elementRef.
The types of child nodes are returned in the childTypesArr array. You
can compare the values returned by the command with the following
constants, found in the "XML" theme:
Constant Type Value
XML Comment Longint 2
XML Processing Instruction Longint 3
XML DATA Longint 6
XML CDATA Longint 7
XML DOCTYPE Longint 10
XML ELEMENT Longint 11
... the $typeArr and $textArr arrays will contain the following values:
$typeArr{1}=6 $textArr{1} = "Hello"
$typeArr{2}=11 $textArr{2} = "AEF1233456878977" (element reference
<Br/>)
$typeArr{3}=6 $textArr{3} = "New"
$typeArr{4}=11 $textArr{4} = "AEF1237897734568" (element reference
<Br/>)
$typeArr{5}=6 $textArr{5} = "York"
DOM Get XML DOM Get XML document ref (elementRef) Æ String
document ref Parameter Type Description
elementRef String Æ Reference of existing element in
DOM tree
The new DOM Get XML document ref command recovers the reference
of the "document" element of the DOM tree whose reference you have
passed in elementRef. The document element is the first element of a
DOM tree; it is the parent of the root element.
The reference of the document element lets you handle the "Doctype"
and "Processing Instruction" nodes. It can only be used with the DOM
Append XML child node and DOM GET XML CHILD NODES commands.
At this level, you can only append processing instructions and
comments or replace the Doctype node. You cannot create CDATA or
Text nodes there.
See Also: DOM GET XML CHILD NODES, DOM Append XML child node
DOM GET XML DOM GET XML ELEMENT VALUE(elementRef; elementValue{; cDATA})
ELEMENT VALUE
Henceforth, if the object received in elementRef is a BLOB, the
command will automatically attempt to decode it into Base64. In fact,
if the BLOB was created by the DOM SET XML ELEMENT VALUE
command, it was automatically encoded in Base64. It is no longer
necessary to call the BASE64 DECODE command.
DOM Insert XML DOM Insert XML element (targetElementRef; sourceElementRef; childIn-
element dex) Æ String
Parameter Type Description
targetElementRef String Æ Parent XML element reference
sourceElementRef String Æ XML element reference to insert
childIndex Longint Æ Index of child of target element
above which the new element must
be inserted
The new DOM Insert XML element command inserts a new XML
element among the child elements of the XML element whose
reference is passed in the targetElementRef parameter.
` In the following structure, we would like to invert the first and second
book:
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<NewBooks>
<Book>
<Title>Open Source Web Services</Title>
<Author>Collective</Author>
<Date>2003</Date>
<ISBN>2-7440-1507-5</ISBN>
<Publisher>Wrox</Publisher>
</Book>
<Book>
See Also: DOM GET XML ATTRIBUTE BY INDEX, DOM GET XML ATTRIBUTE
BY NAME
DOM SET XML DOM SET XML DECLARATION (elementRef; encoding{; standalone{; inden-
DECLARATION tation}}))
Parameter Type Description
elementRef String Æ XML element reference
encoding String Æ XML document character set (UTF-8 by
default)
standalone Boolean Æ True= document is standalone,
False (default)=document is not standa-
lone
indentation Boolean Æ Obsolete, do not use
Compatibility notes • The DOM SET XML DECLARATION command was named DOM SET
XML OPTIONS in previous versions of 4D.
• The DOM options no longer depend on SAX options.
XML SAX
Three commands of the XML SAX theme have been modified. Due to
the implementation of the XML SET OPTIONS and XML GET OPTIONS
commands, the existing SAX SET XML OPTIONS command has been
renamed SAX SET XML DECLARATION and its functioning has been
adapted.
SAX OPEN XML SAX OPEN XML ELEMENT ARRAYS (document; tab{; attrNamesArray; attr-
ELEMENT ARRAYS ValuesArray}{; attrNamesArray2; attrValuesArray2; ...; attrNamesArrayN;
attrValuesArrayN})
Besides text type arrays, the SAX OPEN XML ELEMENT ARRAYS
command now accepts date, number, Boolean and picture arrays as
attrValuesArray parameter(s). 4D automatically carries out the necessary
conversions; you can modify these conversions using the new XML SET
OPTIONS command.
SAX SET XML SAX SET XML DECLARATION (document; encoding{; standalone{; indenta-
DECLARATION tion}})
Parameter Type Description
document DocRef Æ Reference of open document
encoding String Æ XML document character set (UTF-8 by
default)
standalone Boolean Æ True= document is standalone,
False (default)=document is not standa-
lone
indentation Boolean Æ Obsolete, do not use
Compatibility notes • The SAX SET XML DECLARATION command was named SAX SET XML
OPTIONS in previous versions of 4D.
• The SAX options are now valid only for the open document and are
no longer kept after closing this document.
Dynamic variables
You can now leave it to 4D to create variables associated with your
form objects (buttons, enterable variables, check boxes, etc.)
dynamically and according to your needs. To do this, simply leave the
"Variable Name" field blank in the Property list for the object:
Constants
Additional functionalities can be accessed via new constants described
in this section.
Form Events Two new form events have been added in the "Form Events" theme:
Constant Type Value Description
On bound variable Longint 54 Generated when the variable
change bound to a subform is modified.
See the “Management of the
bound variable” paragraph on
page 74.
On Mac toolbar Longint 55 Generated when the user clicks
button on the toolbar management
button under Mac OS. See the
“Toolbar button (Mac OS)”
paragraph on page 118.
Open window The new Has toolbar button Mac OS constant displays a toolbar
management button in a window created under Mac OS (see the
“Toolbar button (Mac OS)” paragraph on page 118).
The Metal Look constant has been renamed Texture appearance, in
conformity with the evolution of the Mac OS interface (the "Metal
Look" option of the Form editor Property List has also been renamed
"Textured (under Mac OS)").
Constant Type Value
Has toolbar button Mac OS Longint 8192
Texture appearance Longint 2048
` Example of use:
$NewWin:=Open window(10;10;1010;810;Plain window+Has toolbar
button Mac OS)
Note The Has toolbar button Mac OS constant can also be used with the
Open form window command.
System Documents A new constant has been added to the "System Documents" theme:
Folder separator. This constant has a different value depending on the
operating system from which it is called:
Constant Type Value
Folder separator String \ (Windows) or
: (Mac OS)
This constant can be used to build valid pathnames without taking the
operating platform into account.
4D Widgets
4D v12 integrates high-level form objects that are provided via a new
component called 4D Widgets. These objects are described in the
“Widgets” paragraph on page 82.
These default values may be the factory settings but may also have
been modified via the SET DEFAULT commands of the component.
The action of this command is immediate: the default values of
objectName are instantly modified. Note that the variable associated
with the object could also be modified in order to take the new values
into account. For example, if the new default values set the minimum
date to 01/01/2000 and the variable associated with objectName was
05/05/1995, its value is automatically returned to 01/01/2000
` This example resets the parameters of the Date1 object to their default
settings:
DatePicker APPLY DEFAULT VALUES ("Date1")
The two optional parameters specify the location of the top left corner
of the window to be opened. These two parameters must be passed
together; if only one is passed, it is ignored.
If these parameters are omitted, the window is opened at the location
of the click.
The function returns the date selected by the user in the DatePicker
calendar. If the window is closed without a date being selected, the
command returns a blank date.
Note that this setting is only taken into account for calendars created
subsequently and is not applied to any existing calendars. If you want
to apply it to existing calendars, you must use the DatePicker APPLY
DEFAULT VALUES command.
DatePicker SET DAYS DatePicker SET DAYS OFF (objectName; dayType; ptrHolidaysArray)
OFF
Parameter Type Description
objectName Text Æ Name of subform object
dayType Longint Æ Types of days off
ptrDaysOffArray Pointer Æ Pointer to date or Boolean array of
days off
The DatePicker SET DAYS OFF command sets the days off to be shown in
the DatePicker calendar. These days appear in bold and italic and
remain selectable for the user.
This command can be used to set either recurrent weekly or yearly days
off as well as occasional holidays. You specify the type of days off set
via the dayType parameter:
0 = Days off occurring weekly (by default, Saturday and Sunday)
1 = Days off that occur every year (such as January 1st or December
25th)
2= Occasional holidays, set for a single year.
You set the holidays by creating a array and by passing a pointer to this
array as the ptrDaysOffArray parameter. The type of array depends on
the value passed in dayType:
If you pass 0 in dayType (weekly days off), in ptrDaysOffArray you
must pass a pointer to a Boolean array made up of 7 elements. Each
element set to True indicates a weekly day off.
If you pass 1 or 2 in dayType (yearly or occasional days off), in
ptrDaysOffArray you must pass a pointer to a Date array. In this
array, each element must contain a valid date, indicating a day off.
The dates must be expressed in the default format corresponding to
the system language. If you passed 1 in dayType (recurrent days), the
year is ignored; you can pass any value.
See Also: DatePicker SET WEEK FIRST DAY, DatePicker SET DEFAULT DAYS
OFF
The DatePicker SET DEFAULT 1ST DAY command sets the first day of the
week to be displayed by default in the left part of all DatePicker
calendars.
Note that this parameter is only taken into account for calendars
created subsequently and does not apply to any existing calendars. If
you want to apply it to existing calendars, you must use the DatePicker
APPLY DEFAULT VALUES command.
See Also: DatePicker SET MAX DATE, DatePicker SET DEFAULT MIN DATE
DatePicker SET DEFAULT DatePicker SET DEFAULT DAYS OFF (dayType; ptrDaysOffArray)
DAYS OFF
Parameter Type Description
dayType Longint Æ Types of days off
ptrDaysOffArray Pointer Æ Pointer to date or Boolean array of
days off
The DatePicker SET DEFAULT DAYS OFF command sets the days off that
will appear in all the calendars of the DatePicker component. These
days appear in bold and italic and remain selectable for the user.
Note that this setting is only taken into account for calendars that are
created subsequently and does not apply to any existing calendars. If
you want to apply it to the existing calendars, you will need to use the
DatePicker APPLY DEFAULT VALUES command.
The command can be used to set recurrent weekly or yearly days off as
well as occasional holidays. You specify the type of days off set by the
method via the dayType parameter:
0 = Days off occurring weekly (by default, Saturday and Sunday)
1 = Days off that occur every year (such as January 1st or December
25th)
2 = Occasional holidays, set for a single year
You set the holidays by creating a array and by passing a pointer to this
array as the ptrDaysOffArray parameter. The type of array depends on
the value passed in dayType:
If you pass 0 in dayType (weekly days off), in ptrDaysOffArray you
must pass a pointer to a Boolean array made up of 7 elements. Each
element set to True indicates a weekly day off.
If you pass 1 or 2 in dayType (yearly or occasional days off), in
ptrDaysOffArray you must pass a pointer to a Date array. In this
array, each element must contain a valid date, indicating a day off.
The dates must be expressed in the default format corresponding to
the system language. If you passed 1 in dayType (recurrent days), the
year is ignored; you can pass any value.
The DatePicker SET DEFAULT MAX DATE command sets the maximum
enterable day for all the calendars of the DatePicker component.
Note that this parameter is only taken into account for calendars
created subsequently and does not apply to any existing calendars. If
you want to apply it to existing calendars, you must use the DatePicker
APPLY DEFAULT VALUES command.
See Also: DatePicker SET MAX DATE, DatePicker SET DEFAULT MIN DATE
The DatePicker SET DEFAULT MIN DATE command sets the minimum
enterable day for all the calendars of the DatePicker component.
Note that this parameter is only taken into account for calendars
created subsequently and does not apply to any existing calendars. If
you want to apply it to existing calendars, you must use the DatePicker
APPLY DEFAULT VALUES command.
See Also: DatePicker SET MIN DATE, DatePicker SET DEFAULT MAX DATE
Note If the maximum enterable date is earlier than the minimum enterable
date (see DatePicker SET MIN DATE), no date will be enterable.
` Disabling all dates after December 31, 2009 in the object named
"ReturnDate":
DatePicker SET MAX DATE("ReturnDate";!12/31/2009!)
The DatePicker SET MIN DATE command sets the minimum enterable
date in a DatePicker calendar (the days located before this minimum
date appear grayed out in the calendar).
Note If the minimum enterable date is later than the maximum enterable
date (see DatePicker SET MAX DATE), no date will be enterable.
DatePicker SET WEEK DatePicker SET WEEK FIRST DAY (objectName; dayNum)
FIRST DAY
Parameter Type Description
objectName Text Æ Name of subform object
dayNum Longint Æ Number of first day to display
The DatePicker SET WEEK FIRST DAY command sets the first day of the
week to display in the left part of a DatePicker calendar. By default, the
first day is Monday.
Pass a 4D constant from the "Days and Months" theme in the dayNum
parameter.
The method of this component sets the help text of the area.
` Displays the word "Country" in the area, indicating that the search will
concern this variable:
C_TEXT(vCountry)
SearchPicker SET HELP TEXT("vSearch";"Country")
TimePicker The TimePicker component provides graphic objects for the entry and
display of times in forms. For more information, refer to the
“TimePicker” paragraph on page 87.
These default values may be the factory settings but may also have
been modified via the SET DEFAULT commands of the component.
The action of this command is immediate: the default values of
objectName are instantly modified. Note that the bound variable of the
object could also be modified in order to take the new values into
account. For example, if the new default values set the minimum time
to 07:00:00 and the value of the variable bound with objectName was
06:00:00, its value is automatically returned to 07:00:00.
Note that this parameter is only taken into account for TimePicker
objects created subsequently and does not apply to any existing
objects. If you want to apply it to existing objects, you must use the
TimePicker APPLY DEFAULT VALUES command.
This setting is only taken into account for objects created subsequently
and does not apply to any existing objects. If you want to apply it to
existing objects, you must use the TimePicker APPLY DEFAULT VALUES
command.
The TimePicker SET LABEL PM command modifies the default "PM" label
in all the TimePicker objects displaying the AM/PM format.
This setting is only taken into account for objects created subsequently
and does not apply to any existing objects. If you want to apply it to
existing objects, you must use the TimePicker APPLY DEFAULT VALUES
command.
This setting is only taken into account for objects created subsequently
and does not apply to any existing objects. If you want to apply it to
existing objects, you must use the TimePicker APPLY DEFAULT VALUES
command.
This setting is only taken into account for objects created subsequently
and does not apply to any existing objects. If you want to apply it to
existing objects, you must use the TimePicker APPLY DEFAULT VALUES
command.
The TimePicker SET DEFAULT STEP command sets the step between time
values for all the TimePicker objects.
This setting is only taken into account for objects created subsequently
and does not apply to any existing objects. If you want to apply it to
existing objects, you must use the TimePicker APPLY DEFAULT VALUES
command.
` Using "in the morning" by default instead of the system label for AM:
TimePicker SET LABEL AM("clock"; "in the morning")
` Using "in the evening" by default instead of the system label for PM:
TimePicker SET LABEL PM("clock"; "in the evening")
The TimePicker SET MAX TIME command sets the maximum enterable
time that will be accepted by the object designated by objectName. If a
higher time value is entered, it will not be accepted.
The TimePicker SET MIN TIME command sets the minimum enterable
time that will be accepted by the object designated by objectName. If a
lower time value is entered, it will not be accepted.
The TimePicker SET STEP command sets the step between time values
available for the object designated by objectName. This parameter only
applies to TimePickers displayed as pop-up menus.
The step value must be included between 1 minute and 1 hour and
must be shown as whole divisions of 60 minutes. In practice, only the
values 1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 30 and 60 min are possible. Any
other value will automatically be rounded off in order to correspond to
this principle.
4D SVG
Version 12 of the 4D SVG component includes several new commands
as well as a few modified commands. All these commands will be
covered in the following paragraphs.
Attributes
SVG_SET_CLASS SVG_SET_CLASS (svgObject; class)
Parameter Type Description
svgObject SVG_Ref Æ Reference of SVG element
class Text Æ Name of class
The SVG_SET_CLASS command sets the class for the object passed in
svgObject. An error is generated if svgObject is not a valid reference.
//Creating a group
$Dom_g:=SVG_New_group ($Dom_SVG)
//Inserting an image
$Txt_path:= Get 4D folder(6)+"logo.svg"
READ PICTURE FILE($Txt_path;$Pic_buffer)
$Dom_picture:=SVG_New_embedded_image ($Dom_g;$Pic_buffer)
SVG_SET_ID ($Dom_picture;"MyPicture")
` The same image with a rectangular clip path with rounded corners:
//Defining a rectangular clip path
$Dom_clipPath:=SVG_Define_clip_path ($Dom_SVG;"theClip")
$Dom_rect:=SVG_New_rect ($Dom_clipPath;5;10;320;240;10;10)
//Creating a group
$Dom_g:=SVG_New_group ($Dom_SVG)
//Inserting an image
$Txt_path:= Get 4D folder(6)+"logo.svg"
READ PICTURE FILE($Txt_path;$Pic_buffer)
$Dom_picture:=SVG_New_embedded_image ($Dom_g;$Pic_buffer)
SVG_SET_ID ($Dom_picture;"MyPicture")
The SVG_SET_FILL_RULE command specifies the fill rule for the SVG
object designated by svgObject. An error is generated if svgObject is not a
valid reference.
The whole value of the dash parameter indicates the length of the first
dash of the dotted pattern. If the value1 to valueN parameters are
omitted, the dotted line will consists of a series of dashes and gaps of
the same length.
The decimal value of the dash parameter, if it is not null, indicates the
distance into the pattern from which the dashes will start.
//Rectangle
$Dom_rect:=SVG_New_rect ($Dom_SVG;25;30;320;240;10;10;"red";
"yellow:30")
SVG_SET_STROKE_WIDTH ($Dom_rect;5)
SVG_SET_STROKE_DASHARRAY ($Dom_rect;2)
//Circle
$Dom_circle:=SVG_New_circle ($Dom_SVG;350;400;100;"blue";"none")
SVG_SET_STROKE_DASHARRAY ($Dom_circle;2;4;6;8)
If the join parameter is -1, the value will be the default value (4). If the
join parameter is 0, then the definition of the attribute is removed. Any
other value < 0 will cause an error.
Colors and
Gradients
cyan, magenta, yellow and black are longints included between 0 and
100%.
The optional format parameter specifies the desired format for the color
string returned. The values are:
Vakue Format
1 (default) rgb(r,g,b)
2 #rgb
3 #rrggbb
4 rgb(r%, g%, b%)
The optional format parameter specifies the desired format for the color
string returned. The values are:
Value Format
1 (default) rgb(r,g,b)
2 #rgb
3 #rrggbb
4 rgb(r%, g%, b%)
Drawing
Structure and
Definitions
The clipPathID parameter designates the name of the clip path. This
name will be used to associate a clip path with an object. If an element
with the same name already exists in the document, an error is
generated.
The patternID parameter specifies the name of the pattern. This name
will be used to associate the pattern with an object. If an element with
the same name already exists, an error is generated.
The optional width, height, x, y, unit and viewBox parameters define the
reference rectangle of the pattern, in other words, the way the pattern
tiles will be placed and spaced.
SVG_PATH_MOVE_TO ($Dom_path;0;0)
SVG_PATH_LINE_TO ($Dom_path;7;0)
SVG_PATH_LINE_TO ($Dom_path;3,5;7)
SVG_PATH_CLOSE ($Dom_path)
SVG_SET_FILL_BRUSH ($Dom_path;"red")
SVG_SET_STROKE_BRUSH ($Dom_path;"blue")
` Setting a pattern and using it to fill and stroke the outline of an ellipse:
//Definition of pattern
$Dom_pattern:=SVG_Define_pattern ($Dom_SVG;"MyPattern ";80;80;0;
0;"";"0 0 20 20")
$Dom_rect:=SVG_New_rect ($Dom_pattern;0;0;20;20;0;0;"white";"red")
//Drawing an ellipse
$Dom_ellipse:=SVG_New_ellipse ($Dom_SVG;400;200;350;150)
The style parameter embeds style sheets directly within SVG content:
If the style parameter contains a valid pathname to a CSS file, the style
definition is done using a mechanism referencing external style sheets.
The path, if it begins with the # character or by the string "file:",
expresses a relative path whose root is the "Resources" folder of the
database.
The style parameter can also be an URL of the "http://… " type; in this
case, the style sheet will be referenced as an external resource.
The optional type parameter specifies the language of the style sheet for
the contents of the element. The default value is "text/css".
//Drawing a rectangle
$Dom_rect:=SVG_New_rect ($Dom_g;25;30;320;240;10;10;"";"")
//Drawing a rectangle
$Dom_rect:=SVG_New_rect ($Dom_g;25;30;320;240;10;10;"";"")
mystyle.css file:
.colored {fill: red; fill-opacity: 0.6; stroke: blue; stroke-width:8; stroke-opa-
city: 0.6}
Text
` Adding text
//Display outlines using 'rect' element
$Dom_rect:=SVG_New_rect ( $Dom_SVG;10;10;500;200;0;0;"blue:50";
"none")
The SVG_Get_text command modifies the kerning for the text object
designated by svgObject. If svgObject is not an SVG text object, an error
is generated.
The optional unit parameter specifies the unit of the kerning value. The
default value is "%".
SVG_SET_TEXT_KERNING ($Dom_text;0)
The optional unit parameter specifies the unit of the spacing value. The
default value is "%".
The rendering parameter can have one of the following values: "auto",
"optimizeSpeed", "optimizeLegibility", "geometricPrecision" or
"inherit". Otherwise, an error is generated.
The writingMode parameter can have one of the following values: "lr-
tb", "rl-tb", "tb-rl", "lr", "rl", "tb" or "inherit ". Otherwise, an error is
generated.
//Text
$Dom_text:=SVG_New_textArea ($Dom_SVG;$Txt_sample;10;10;200;
300;"Baghdad 'Arial Unicode MS'";25)
SVG_SET_TEXT_WRITING_MODE($Dom_text;"rl")
Modified commands
Utilities
SVG_ABOUT SVG_ABOUT
Parameter Type Description
This command does not require any parameters
If the method does not exist or is not shared, the error -10508 is
generated by 4D.
Modified commands
This section covers the new features and modifications made to the
SQL engine of 4D v12:
New function for replicating database via SQL
Note The use of new SQL statements in the code editor is facilitated via
specific macro commands. To be able to take advantage of them, you
will need to update your "Macros.xml" file. For more information
about this point, refer to the “Updating the Macros.xml file” paragraph
on page 17.
New virtual fields Each table of the 4D database can be assigned three new "virtual" fields:
__ROW_ID, __ROW_STAMP and __ROW_ACTION. These fields are
called "virtual" to differentiate them from "standard" fields because
they have specific properties: they are automatically filled in, can be
read but not modified by the users, and do not appear in the system
tables of the database. The following table describes these fields as well
as their mode of use:
Virtual field Type Content Use
__ROW_ID Int32 ID of record In any SQL state-
ment except for
REPLICATE or SYN-
CHRONIZE
__ROW_STAMP Int64 Record replication infor- In any SQL state-
mation ment
__ROW_ACTION Int16 Type of action carried out Only with the
on the record: REPLICATE or SYN-
1 = Addition or modifica- CHRONIZE com-
tion mand
2 = Deletion
Enabling replication By default the mechanisms that allow replication are not enabled. You
must explicitly enable them in both the remote and local database for
each table to be used in the replication or synchronization.
Note that enabling the mechanism does not trigger the replication
itself; in order for the data to actually be replicated in a local or
synchronized database, you must use the new REPLICATE or
SYNCHRONIZE commands.
To enable the internal replication mechanism for each table (on the
remote and local database), you must use the new Enable Replication
table property that is found in the table Inspector:
Enabling of replication
Update on local Once the replication mechanism is enabled in the each table of each
database side database, you can use it from the local database via the new SQL
REPLICATE command. This command is described in the “New SQL
commands” paragraph on page 308
Note 4D also allows you to manage primary keys directly in the structure
editor. For more information, refer to the “Setting the primary key”
paragraph on page 23.
Support of joins
The SQL engine of 4D v12 extends the support of joins and more
particularly allows outer joins to be carried out.
Note The current implementation of joins in the 4D SQL engine does not
include:
- natural joins.
- the USING construct on inner joins.
Overview Join operations make connections between the records of two or more
tables and combine the result in a new table, called a join.
You generate joins via SELECT statements that specify the join
conditions. With explicit joins, these conditions can be complex but
they must always be based on an equality comparison between the
columns included in the join. For example, it is not possible to use the
>= operator in an explicit join condition.
Any type of comparison can be used in an implicit join.
Note Usually, in the database engine, the table order is determined by the
order specified during the search. However, when you use joins, the
order of the tables is determined by the list of tables. In the following
example:
SELECT * FROM T1 RIGHT OUTER JOIN T2 ON T2.depID = T1.depID;
... the order of the tables is T1 then T2 (as they appear in the list of
tables) and not T2 then T1 (as they appear in the join condition).
Explicit inner joins An inner join is based on a comparison to find matches between two
columns. For example, if we consider the three following tables:
Employees
name depID cityID
Alan 10 30
Anne 11 39
Bernard 10 33
Mark 12 35
Martin 15 30
Philip NULL 33
Thomas 10 NULL
Departments
depID depName
10 Program
11 Engineering
NULL Marketing
12 Development
13 Quality
Cities
cityID cityName
30 Paris
33 New York
NULL Berlin
Note The example structure above will be used throughout this section.
In 4D v12, you can now use the JOIN keyword to specify an explicit
inner join:
SELECT *
FROM employees
INNER JOIN departments
ON employees.DepID = departments.DepID;
Note that neither the employees named Philip or Martin nor the
Marketing or Quality departments appear in the resulting join because:
Philip does not have a department associated with his name (NULL
value),
The department ID associated with Martin’s name does not exist in
the Departments table,
Cross joins A cross or Cartesian join is an inner join for which no WHERE nor ON
clauses have been specified. It consists in associating each row of one
table with each row of another table.
The result of a cross join is the Cartesian product of the tables,
containing a x b rows, where a is the number of rows in the first table
and b is the number of rows in the second table. This product
represents every possible combination formed by the concatenation of
the rows of both tables.
Martin 15 11 Engineering
Philip NULL 11 Engineering
Thomas 10 11 Engineering
Alan 10 NULL Marketing
Anne 11 NULL Marketing
Bernard 10 NULL Marketing
Mark 12 NULL Marketing
Martin 15 NULL Marketing
Philip NULL NULL Marketing
Thomas 10 NULL Marketing
Alan 10 12 Development
Anne 11 12 Development
Bernard 10 12 Development
Mark 12 12 Development
Martin 15 12 Development
Philip NULL 12 Development
Thomas 10 12 Development
Alan 10 13 Quality
Anne 11 13 Quality
Bernard 10 13 Quality
Mark 12 13 Quality
Martin 15 13 Quality
Philip NULL 13 Quality
Thomas 10 13 Quality
Note For performance reasons, cross joins should be used with precaution.
Outer joins You can now generate outer joins with 4D v12. With outer joins, it is
not necessary for there to be a match between the rows of joined
tables. The resulting table contains all the rows of the tables (or of at
least one of the joined tables) even if there are no matching rows. This
means that all the information of a table can be used, even if the rows
are not completely filled in between the different joined tables.
There are three types of outer joins, specified using the LEFT, RIGHT
and FULL keywords. LEFT and RIGHT are used to indicate the table
(located to the left or right of the JOIN keyword) where all the data
must be processed. FULL indicates a bilateral outer join.
Left outer joins The result of a left outer join (or left join) always contains all the
records for the table located to the left of keyword even if the join
condition does not find a matching record in the table located to the
right. This means that for each row in the left table where the search
does not find any matching row in the right table, the join will still
contain this row but it will have NULL values in each column of the
right table. In other words, a left outer join returns all the rows of the
left table plus any of those of the right table that match the join
condition (or NULL if none match). Note that if the right table
contains more than one row that matches the join predicate for a
single row of the left table, the values of the left table will be repeated
for each distinct row of the right table.
Here is the result of this join with our example database (additional
rows shown in red):
aName aEmpDepID aDepID aDepName
Alan 10 10 Program
Anne 11 11 Engineering
Bernard 10 10 Program
Mark 12 12 Development
Thomas 10 10 Program
Martin 15 NULL NULL
Philip NULL NULL NULL
Right outer joins A right outer join is the exact opposite of a left outer join (see previous
paragraph). Its result always contains all the records of the table
located to the right of the JOIN keyword even if the join condition
does not find any matching record in the left table.
Here is the result of this join with our example database (additional
rows shown in red):
aName aEmpDepID aDepID aDepName
Alan 10 10 Program
Anne 11 11 Engineering
Bernard 10 10 Program
Mark 12 12 Development
Thomas 10 10 Program
NULL NULL NULL Marketing
NULL NULL 13 Quality
Full outer joins A full outer join simply combines together the results of a left outer
join and a right outer join. The resulting join table contains all the
records of the left and right tables; it fills in the missing fields on each
side with NULL values.
Here is the result of this join with our example database (additional
rows shown in red):
aName aEmpDepID aDepID aDepName
Alan 10 10 Program
Anne 11 11 Engineering
Bernard 10 10 Program
Mark 12 12 Development
Thomas 10 10 Program
Martin 15 NULL NULL
Philip NULL NULL NULL
NULL NULL NULL Marketing
NULL NULL 13 Quality
Multiple joins in a single It is possible to combine several joins in the same SELECT statement. It
statement is also possible to mix implicit or explicit inner joins and explicit outer
joins.
You can create an external database directly from the main database
with the new SQL CREATE DATABASE command. The database is stored
on disk in standard files (.4db and .4dd files). You can create as many
external databases as you want from the main 4D database.
Once created, an external database can be designated as the current
database using the new SQL USE DATABASE command. It can then be
modified via standard SQL commands (CREATE TABLE, ALTER TABLE,
etc.) and you can store data in it. The new DATABASE_PATH function
can be used to find out the current database at any time.
The main interest of external databases resides in the fact that they can
be created and worked with via 4D components. This new feature
allows the development of components that are capable of creating
tables and fields according to their needs.
Creating a UUID In the structure editor, a UUID field is specified by assigning a specific
field property to an Alpha field (see the “UUID format” paragraph on
page 21).
On the 4D SQL side, a UUID field is identified via a new data type:
UUID. This data type can be used with the commands that create or
modify fields. For example:
Begin SQL
CREATE TABLE ACTORS_FAN
(ID UUID,
Name VARCHAR(30));
End SQL
Or:
Begin SQL
CREATE TABLE ACTORS_FAN
(Name VARCHAR(30));
ALTER TABLE ACTORS_FAN
ADD ID UUID;
End SQL
You use the DATAFILE clause to specify the complete name (complete
pathname + name) of the new external database. You must pass the
name of the structure file. The program automatically adds the ".4db"
extension to the file if it is not already specified and creates the data
file. The pathname can be expressed either in POSIX syntax or in the
system syntax. It can be absolute or relative to the structure file of the
main 4D database.
POSIX syntax (URL type): folder names are separated by a slash ("/"),
regardless of the platform that you use, for example:
.../extdatabases/myDB.4db
system syntax: pathname respecting the syntax of the current
platform, for example:
- (Mac OS) Disk:Applications:myserv:extdatabases:myDB.4db
- (Windows) C:\Applications\myserv\extdatabases\myDB.4db
If you are using 4D in remote mode, the REMOTE keyword can be used
to designate an external database located on 4D Server.
For security reasons, this mechanism only works with native remote
connections, in other words, in the context of a remote 4D database
connected with 4D Server. Connections via ODBC or pass-through
connections are not allowed.
If no keyword is specified, the LOCAL option is used by default. If you
are using 4D in local mode, the REMOTE and LOCAL keywords are
ignored: connections are always local.
You must designate a valid external database, and one where access
control has not been activated (by assigning a password to the
Designer). Otherwise, an error is generated.
Note The virtual fields of the remote table can only be stored in the arrays of
the local database.
Remote database side The optional WHERE clause can be used to apply a preliminary filter to
the records of the table in the remote database so that only those
records that satisfy the search_condition will be taken into account by
the command.
4D then recovers the values of the replicated_list fields for all the
records designated by the FOR REMOTE STAMP clause. The value passed
in this clause can be either:
a value of the type longint > 0: In this case, records where the value
of __ROW_STAMP is greater than or equal to this value are
recovered.
0: In this case, all the records where the value of __ROW_STAMP is
different from 0 are recovered. Note that any records that existed
before the enabling of replication will therefore not be taken into
account (the value of their __ROW_STAMP = 0).
-1: In this case, all the records of the remote table are recovered; in
other words, all the records where the value of __ROW_STAMP >= 0.
Unlike the previous case, all the records of the table, including any
that existed before replication was enabled, will be taken into
account.
-2: In this case, all the records deleted from the remote table (after
enabling of replication) are recovered; in other words, all the
records where the value of __ROW_ACTION = 2.
Finally, you can apply the optional OFFSET and/or LIMIT clauses to the
selection obtained:
When it is passed, the OFFSET clause ignores the first X records of
the selection (where X is the value passed to the clause).
When it is passed, the LIMIT clause restricts the result selection to
the first Y records (where Y is the value passed to the clause). If the
OFFSET clause is also passed, the LIMIT clause is applied to the
selection obtained after the execution of OFFSET).
Once both clauses have been applied, the resulting selection is sent to
the local database.
Local database side The values recovered are directly written into the target_list of the local
database or in the standard fields specified by sql_name of the
table_reference table of the local database. The target_list argument can
contain either a list of standard fields or a list of arrays of the same type
as the remote fields (but not a combination of both). If the destination
of the command is a list of fields, the target records will be
automatically created, modified or deleted according to the action
stored in the virtual __ROW_ACTION field.
Note Operations carried out by the REPLICATE command do not take data
integrity constraints into account. This means, for instance, that the
rules governing foreign keys, uniqueness, and so on, are not checked.
If the data received could undermine data integrity, you must check
the data after the replication operation is finished. The simplest way is
to lock, using SQL or the 4D language, the records that have to be
modified.
SYNCHRONIZE SYNCHRONIZE
[LOCAL] TABLE table_reference (sql_name_1;...;sql_name_N)
WITH
[REMOTE] TABLE table_reference (sql_name_1;...;sql_name_N)
FOR REMOTE [STAMP] {int_number | 4d_language_reference}
LOCAL [STAMP] {int_number | 4d_language_reference}
{REMOTE OVER LOCAL | LOCAL OVER REMOTE}
LATEST REMOTE [STAMP] 4d_language_reference
LATEST LOCAL [STAMP] 4d_language_reference;
Note Input and output stamps are expressed as number values and not as
timestamps. For more information about these stamps, refer to the
description of the REPLICATE command.
Conflicts are resolved using the REMOTE OVER LOCAL and LOCAL OVER
REMOTE clauses, that clearly indicate which server will have priority if
the same record has been modified on both sides. For more
information about the implementation mechanisms, refer to the
description of the REPLICATE command.
New function
DATABASE_PATH DATABASE_PATH()
Note The PRIMARY KEY keyword is accepted since version 11.4 of 4D.
Note The PRIMARY KEY keyword is accepted since version 11.4 of 4D.
Generic modules
Name Web site Description
BCMath http://php.net/bc Binary calculator handling numbers of any size and
precision represented as strings.
Example:
// Returns the result of ($myValue*$myValue*$myValue)
PHP Execute("";"bcpow";$result;String($myValue);"3";)
Calendar http://php.net/calendar Set of functions simplifying conversion between dif-
ferent calendar formats. Based on Julian Day Count.
Example:
PHP Execute("";"cal_days_in_month";Number of days in Febrary;1;2;Year())
Multibyte String http://php.net/mbstring Set of functions for working with strings that can be
used to handle multi-byte character encodings or to
convert character strings.
If (PHP Execute($1))
PHP GET FULL RESPONSE ($0;$errorInfos;$errorValues;$headerFields;
$headerValues)
$idx:=Find in array($headerFields; "Set-Cookie")
If ($idx>0)
<>PHP_Session:=$headerValues{$idx}
End if
End if
SimpleXML http://php.net/simpleXML Very simple and easy-to-use tools to be used to con-
vert XML to an object that can be processed with its
properties and array iterators.
SPL (Standard PHP http://php.net/spl Collection of interfaces and classes that are meant
Library) to solve standard problems.
Modules only For structural reasons, the following PHP modules are only available
available under on the Windows platform.
Windows
Name Web site Description
COM & .NET http://php.net/com COM (Component Object Model) is one of the
main ways for applications and components to
communicate on Windows platforms.
In addition, 4D supports the instantiation and cre-
ation of .Net assemblies via the COM layer.
WDDX (Web Dis- http://php.net/wddx Facilitates data exchanges between Web applica-
tributed Data tions over the Web, regardless of the platform.
eXchange)
Disabled modules
The following PHP modules have not been implemented in 4D v12.
The rightmost column gives the reason they were not implemented:
Name Web site Cause - Alternative solution
Mimetype http://php.net/mime-magic Obsolete (Deprecated) - Use Fileinfo
POSIX (Portable http://php.net/posix
Operating System Obsolete (Deprecated)
Interface)
Regular Expression http://php.net/regex
Obsolete (Deprecated) - Use PCRE
(POSIX Extended)
Crack http://php.net/crack Restrictive license
ffmpeg http://ffmpeg-php.source- Restrictive license - Use ffmpeg in command line
forge.net/ with LAUNCH EXTERNAL PROCESS
Image Magick http://php.net/man- Restrictive license - Use GD 2
ual/book.imagick.php
IMAP (Internet http://php.net/imap Restrictive license - Use the 4D Internet Commands
Message Access integrated plugin
Protocol)
PDF (Portable Doc- http://php.net/pdf Restrictive license - Use Haru PDF
ument Format)
eZ components
Note The characteristics of the PHP version provided with 4D v12 are as
follows:
- version 5.3.2
- 32-bit compilation under Windows and Mac OS
- compilation in "thread-safe" mode under Windows and Mac OS.
PHP extensions are available on other Web sites, but in this case they
do not have the security guarantee provided by the validation of the
PHP Group.
Zend extensions
1 Download (http://framework.zend.com/download/latest) and
uncompact the Zend framework into a folder named "zend".
2 Add this "zend" folder in the "include_path" specified in the "php.ini"
file.
3 Read the documentation for Zend framework components:
http://framework.zend.com/manual/en
JELIX extensions
1 Download (http://jelix.org/articles/en/download/stable) and uncompact
the JELIX framework.
2 Add the resulting "jelix" folder in the "include_path" specified in the
"php.ini" file.
3 Read the documentation for JELIX framework components:
http://jelix.org/articles/en/manual-1.1/components
eZ components
1 Download (http://www.ezcomponents.org/download) and uncompact
the eZ components into a "ez" folder.
2 Add the "ez" folder in the "include_path" specified in the "php.ini" file.
3 Read the documentation for eZ components:
http://www.ezcomponents.org/docs/api/latest
This appendix lists the style tags supported by 4D v12 in text areas
having the "Multi-style" attribute. For a description of this attribute,
refer to the “Rich text” paragraph on page 94.
You can use these tags to set up custom style management. Only the
tags listed below are supported by 4D for style variations.
Font style
Bold
Italic or normal
Underline
Strikethrough
<SPAN STYLE="text-decoration:line-through">...</SPAN>
Note The "strikethrough" style is not supported under Mac OS. However, the
corresponding tag can be used by programming.
or
<SPAN STYLE="color:#006CCC">...</SPAN>
<SPAN STYLE="background-color:#006CCC">...</SPAN>
Note Under Mac OS, this attribute is ignored. It is removed if the object is
modified.
Color values For the font color and background color attributes, the color value can
be either the hexadecimal code of RGB colors or the name of one of
the 16 HTML colors specified for the CSS standard by the W3C:
This appendix shows the constants found in the new "Picture metadata
names" and "Picture metadata values" themes of 4D v12. For more
information about the use of these constants, refer to the description
of the SET PICTURE METADATA and GET PICTURE METADATA commands.
GPS
Types of possible values or
Constants of the "Picture
associated constants of the
metadata names" theme Value
"Picture metadata values"
(metaName parameter)
theme (contents parameter)
GPS Altitude GPS/Altitude GPS Above Sea Level
GPS Below Sea Level
GPS Altitude Ref GPS/AltitudeRef GPS Above Sea Level
GPS Below Sea Level
GPS Area Information GPS/AreaInformation Text
GPS Date Time GPS/DateTime Date or Text (XML Datetime)
GPS Dest Bearing GPS/DestBearing Text (1 character)
GPS Dest Bearing Ref GPS/DestBearingRef Text (1 character)
IPTC
Types of possible values or
Constants of the "Picture
associated constants of the
metadata names" theme Value
"Picture metadata values"
(metaName parameter)
theme (contents parameter)
IPTC Byline IPTC/Byline Text or Text array
IPTC Byline Title IPTC/BylineTitle Text or Text array
IPTC Caption Abstract IPTC/CaptionAbstract Text
IPTC Category IPTC/Category Text
IPTC City IPTC/City Text
IPTC Contact IPTC/Contact Text or Text array
IPTC Content Location Code IPTC/ContentLocationCode Text or Text array
IPTC Content Location Name IPTC/ContentLocationName Text or Text array
IPTC Copyright Notice IPTC/CopyrightNotice Text
IPTC Country Primary Location IPTC/CountryPrimaryLocation- Text
Code Code
IPTC Country Primary Location IPTC/CountryPrimaryLocation- Text
Name Name
IPTC Credit IPTC/Credit Text
IPTC Date Time Created IPTC/DateTimeCreated Date or Text (XML Datetime)
IPTC Digital Creation Date Time IPTC/DigitalCreationDateTime Date or Text (XML Datetime)
IPTC Edit Status IPTC/EditStatus Text
IPTC Expiration Date Time IPTC/ExpirationDateTime Date or Text (XML Datetime)
IPTC Fixture Identifier IPTC/FixtureIdentifier Text
IPTC Headline IPTC/Headline Text
IPTC Image Orientation IPTC/ImageOrientation Text
IPTC Image Type IPTC/ImageType Text
IPTC Keywords IPTC/Keywords Text or Text array
IPTC Language Identifier IPTC/LanguageIdentifier Text
IPTC Object Attribute Reference IPTC/ObjectAttributeReference Text
IPTC Object Cycle IPTC/ObjectCycle Text
IPTC Object Name IPTC/ObjectName Text
IPTC Original Transmission Refe- IPTC/OriginalTransmissionRefe- Text
rence rence
IPTC Originating Program IPTC/OriginatingProgram Text
IPTC Program Version IPTC/ProgramVersion Text
IPTC Province State IPTC/ProvinceState Text
IPTC Release Date Time IPTC/ReleaseDateTime Date or Text (XML Datetime)
TIFF
Types of possible values or
Constants of the "Picture
associated constants of the
metadata names" theme Value
"Picture metadata values"
(metaName parameter)
theme (contents parameter)
TIFF Artist TIFF/Artist Text
TIFF Compression TIFF/Compression TIFF Adobe Deflate
TIFF CCIRLEW
TIFF CCITT1D
TIFF DCS
TIFF Deflate
TIFF Epson ERF
TIFF IT8BL
TIFF IT8CTPAD
TIFF IT8LW
TIFF IT8MP
TIFF JBIG
TIFF JBIGB&W
TIFF JBIGColor
TIFF JPEG
TIFF JPEG2000
TIFF JPEGThumbs Only
TIFF Kodak262
TIFF Kodak DCR
TIFF Kodak KDC
TIFF LZW
TIFF MDIBinary Level Codec
TIFF MDIProgressive Transform
Codec
TIFF MDIVector
TIFF Next
TIFF Nikon NEF
TIFF Pack Bits
TIFF Pentax PEF
TIFF Pixar Film
TIFF Pixar Log
TIFF SGILog
TIFF SGILog24
TIFF Sony ARW
TIFF T4Group3Fax
TIFF T6Group4Fax
TIFF Thunderscan
TIFF Uncompressed
TIFF Copyright TIFF/Copyright Text