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”:
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)