guides:programming:programmers_reference_manual:var_to_struct

Var_To_Struct function

Converts an @fm-delimited variable into a structure placing, obtaining each structure element from the corresponding field in the variable.

struct = Var_To_Struct(var, structname)

Use Var_To_Struct when you want to convert an @fm-delimited array into a structure. Alternatively, use Build_Struct() when you want to convert a set of variables into a structure or when the structure contains char or char array fields that will contain characters with values greater than @VM (hex FD, decimal 253).

This function is the opposite of the Struct_To_Var function.

The structure definition must be predefined using the Define_Struct routine.

/* assuming the structure called RECT has been defined as being composed of 4 "signed short" elements, this code builds a rectangle structure based on the location and size of an OpenInsight form */

declare function Get_Property, Var_To_Struct

* build the rectangle out of the SIZE property

size    = Get_Property(@window, "SIZE")
size<3> = size<3> + size<1> ;* convert width to right
size<4> = size<4> + size<2> ;* convert height to bottom
rect    = Var_To_Struct(size, "RECT")
  • guides/programming/programmers_reference_manual/var_to_struct.txt
  • Last modified: 2024/06/19 20:20
  • by 127.0.0.1