PV SET STYLE PROPERTY
version 6.8
PV SET STYLE PROPERTY (area; style; property; value)
Parameter | Type | Description | |
area | Longint | 4D View area | |
style | Longint | Stylesheet ID | |
property | Longint | Property number | |
value | Longint | Property value |
Description
The PV SET STYLE PROPERTY command sets the value of property for the style sheets whose number is style.
Use the PV Style properties constants theme to define the property parameter.
Use the PV Style values constants theme to define the value parameter. The choice of constant to assign to the value parameter depends on the property chosen.
These constants are detailed in the PV SET CELL PROPERTY command description.
If you want to edit the default style sheets properties, pass one of the PV Style special values constants in the style parameter:
• pv style cells: default style sheet for cells (named "Cells").
• pv style col row headers: default style sheet for column and row headers (named "Columns/Rows Headers").
• pv style page footer header: default style sheet for printed page header and footer (named "Page Header & footer".
Note: These style sheets can be edited using the Style Sheets command in the 4D View's Style menu.
Example
This method allows defining properties for a new style. In this example, we will set a value for each of the three style properties to customize:
• The "horizontal alignment" property will become "to the left",
• The "vertical alignment" property will become "center",
• The "rotation" property will become "90 degrees".
ARRAY LONGINT($ArrayProps;3) `Stylesheet properties array
ARRAY LONGINT($ArrayValues;3) `Value of each property
C_STRING(255;$StyleName) `Name of style to add to Area
ARRAY LONGINT($StyleNumArray;0) `Style numbers array
ARRAY STRING(255;$StyleNameArray;0) `Style names array
C_INTEGER($Index) `Loop index
C_INTEGER($Position) `Position of new style in number and name arrays
`Initialization
$ArrayProps{1}:=pv style hor alignment `Corresponding properties...
$ArrayProps{2}:=pv style vert alignment
$ArrayProps{3}:=pv style rotation
$ArrayValues{1}:=pv value hor alignment left `...and values
$ArrayValues{2}:=pv value hor alignment center
$ArrayValues{3}:=pv value rotation 90
$StyleName:="subparagraph"
PV GET STYLE LIST (Area;$StyleNumArray;$StyleNameArray) `List of available styles
If (Find in array($StyleNameArray;$StyleName)=-1) `Style $StyleName absent ?
$Position:=Size of array($StyleNameArray)+1 `We will add it
INSERT ELEMENT ($StyleNameArray;$Position) `Resize arrays
INSERT ELEMENT ($StyleNumArray;$Position)
$StyleNameArray{$Position}:=$StyleName `Assign name of new style
$StyleNumArray{$Position}:=PV Add style (Area;$StyleName) `Assign number of new style
For ($Index;1;Size of array($ArrayProps)) `For all properties to be set
If (PV Get style property (Area;$StyleNumArray{$Position};$ArrayProps{$Index})#$ArrayValues{$Index})
PV SET STYLE PROPERTY (Area;$StyleNumArray{$Position};$ArrayProps{$Index};$ArrayValues{$Index})
End if `Property doesn't have the desired value?
End for `Review array $ArrayProps of stylesheet properties
Else
ALERT("The style'"+$StyleName+"' is already present in the area.")
End if
See Also
Constants
PV Style properties and PV Style values themes.