4D v13.4

OBJECT Get format

Home

 
4D v13.4
OBJECT Get format

OBJECT Get format 


 

OBJECT Get format ( {* ;} object ) -> Function result 
Parameter Type   Description
Operator in If specified, object is an object name (string) If omitted, object is a field or a variable
object  Form object in Object name (if * is specified) or Field or variable (if * is omitted)
Function result  String in Object display format

The OBJECT Get format command returns the current display format applied to the object specified in the object parameter.

If you pass the optional * parameter, you indicate that the object parameter is an object name (in this case, pass a string in object). If you do not pass this parameter, you indicate that the object parameter is a field or variable. In this case, you do not pass a string, but a field or variable reference.

This command returns the current display format of the object; in other words, the format as defined in the Design environment or using the OBJECT SET FORMAT command. OBJECT Get format works with all types of form objects (fields or variables) that accept a display format: Boolean, date, time, picture, string, number, as well as button grids, dials, thermometers, rulers, picture pop-up menus, picture buttons and 3D buttons. For more information on the display formats of these objects, refer to the documentation for the OBJECT SET FORMAT command.

Note: If you apply the command to a set of objects, the form of the last object selected is returned.

When the OBJECT Get format command is applied to date, time or picture objects (formats defined as constants), the string returned corresponds to the character code of the constant. To obtain the value of the constant, simply apply the Character code function to the result (see below).

This example allows you to obtain the value of the format constant applied to the picture variable named “myphoto”:

 C_STRING(2;$format)
 OBJECT SET FORMAT(*;"myphoto";Char(On Background))
  `Apply background format (value = 3)
 $format:=OBJECT Get format(*;"myphoto")
 ALERT("Format number:"+String(Character code($format)))
  `Display value "3"

This example allows you to obtain the format applied to the Boolean field [Members]Marital_status:

 C_STRING(30;$format)
 $format:=OBJECT Get format([Members]Marital_status)
 ALERT($format`Display format, for example "Married;Single"

 
PROPERTIES 

Product: 4D
Theme: Object Properties
Number: 894

 
INDEX

Alphabetical list of commands

 
HISTORY 

Created: 4D 2004
Renamed: 4D v12

 
SEE ALSO 

OBJECT SET FORMAT