The SDL Component Suite is an industry leading collection of components supporting scientific and engineering computing. Please visit the SDL Web site for more information....



How to use TMolForm


TMolForm can be used in three different ways:


displaying molecular formulas

The molecular formula to be displayed can be entered (1) as a specially formatted string by using the property MolFormula, or the method ReadFromString; or (2), by setting the properties NumAtoms, AtNum, AtWgt, and AtCnt. Utilizing the second way requires to know some basic knowledge of the internal representation of molecular formulas.

The colors of the formula can be selected by using the properties ColorTxt, and ColorBkg. The formula may also be displayed with a transparent background by setting the property Transparent to a true value. The visibility of isotopic information can be controlled by the properties IsotopeVis, and UseDeuterium.


performing calculations with molecular formulas

TMolForm offers routines to calculate the nominal and natural molecular weight of a given formula (NominalMolWgt,and ChemMolWgt, resp.), to find (FindFormulaExactMass) all possible molecular formulas for a given weight range, and to compare two formulas.


displaying plain text

An often needed function is to display plain text instead of a molecular formula. The property ShowAsText allows to switch between displaying the molecular formula and any arbitrary text defined by the property MolFormula.

Hint: TMolForm cannot display molecular formulas using parantheses, e.g. Ca(OH)2, or CH3(CH2)4CH4. In such cases you should consider to use the THtmlLab component which can render any text using HTML code.



Last Update: 2023-Feb-06