4D v16.3

OBJECT Get format

Home

 
4D v16.3
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, 3D buttons, and list box headers. 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"



See also 

OBJECT SET FORMAT

 
PROPERTIES 

Product: 4D
Theme: Objects (Forms)
Number: 894

 
HISTORY 

Created: 4D 2004
Renamed: 4D v12
Modified: 4D v15 R5

 
ARTICLE USAGE

4D Language Reference ( 4D v16)
4D Language Reference ( 4D v16.1)
4D Language Reference ( 4D v16.2)
4D Language Reference ( 4D v16.3)