Assign(Value: ITabFont);
The Value is the font, the parameters of which should be assigned to the current font.
The Assign method assigns the parameters of the font, specified as the Value input parameter to the current font.
When this method is called all parameters specified for the original font passed by the Value parameter are to be set for the current font. Parameters defined for a current font and undefined for an original one, are to be reset.
Sub UserProc;
Var
Style1, Style2, Style3, Style4: ITabCellStyle;
Font2, Font4: ITabFont;
Begin
Style1 := New TabCellStyle.Create;
Style2 := New TabCellStyle.Create;
Style3 := New TabCellStyle.Create;
Style4 := New TabCellStyle.Create;
//Determines font parameters
Style1.Font.Bold := TriState.OnOption;
Style2.Font.Italic := TriState.OnOption;
//Parameters of font of the second style
Style3.Font.Bold := TriState.OnOption;
Style4.Font.Italic := TriState.OnOption;
//Applies font styles
Font2 := Style2.Font;
Font4 := Style4.Font;
Font2.Apply(Style1.Font);
Font4.Assign(Style3.Font);
//Checkes adjusted parameters
Debug.WriteLine(Font2.Bold);
Debug.WriteLine(Font2.Italic);
Debug.WriteLine(Font4.Bold);
Debug.WriteLine(Font4.Italic);
End Sub UserProc;
When this example is executed four styles are created. One of the font parameters is enabled. Parameters of the Style1 font are applied to Style2, and Style3 parameters are applied to Style4. When the Apply method is used, as the Italic parameter specified in Style2 it is not reset when Style1 is apllied. When the Assign method is used, as the Italic parameter is undefined in Style3, the value of this parameter is to be reset in Style4.
After executing this example console of development environment displays the following results of checking properties' values:
-1
-1
-1
-2
See also: