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....



Interface of SDL_CForm


const
  FormMaxEl = 20;               { max. number of elements in molecular formula }
{$IFDEF PAIDVERS}
  SDLVersionInfo = 'cform_r1050_full';
  IsLightEd = false;
{$ELSE}
  SDLVersionInfo = 'cform_r1050_lighted';
  IsLightEd = true;
{$ENDIF}
  release = 1050;

type
  TIsotVisib = (ivNone, ivSpecial, ivAlways);
  TFormulaRec = record
                  FLeng : integer;
                  AtNum : array[1..FormMaxEl] of byte;         { atomic number }
                  AtWgt : array[1..FormMaxEl] of byte;       { isotopic weight }
                  AtCnt : array[1..FormMaxEl] of byte;            { atom count }
                end;
  TMolForm =
       class (TGraphicControl)
       private
         FAlignment    : TAlignment;          { alignment of molecular formula }
         FColorBkg     : TColor;                   { color of panel background }
         FColorTxt     : TColor;                       { color of formula text }
         FBFLeng       : integer;                 { number of valid atom types }
         FPermutCnt    : array[1..FormMaxEl] of longint;
                         { permutation count for molecular formula calculation }
         FMassBForm    : double;                   { mass of molecular formula }
         FTolBForm     : double;              { tolerance of molecular formula }
         FUseDeuterium : boolean;                  { true: use D instead of 2H }
         FShowAsText   : boolean;           { true: label is displayed as text }
         FTransparent  : boolean;               { true: transparent background }
         FFormulStr    : string;     {string which contains the formula as text}
         FAtNum        : array[1..FormMaxEl] of byte;          { atomic number }
         FAtWgt        : array[1..FormMaxEl] of byte;        { isotopic weight }
         FAtCnt        : array[1..FormMaxEl] of byte;             { atom count }
         FIsotVis      : TIsotVisib;       { visibility of isotope information }
         FLowBForm     : TFormulaRec; { lowest allowed indices of mol. formula }
         FHighBForm    : TFormulaRec;{ highest allowed indices of mol. formula }

         function  ChemElem (AtNr, AtWt, AtNum: integer; Format: byte): string;
         function  FindFormulaIntern(IntMass, CheckPlausibility: boolean): boolean;
         function  GetMolFormula: string;
         function  GetAtNum (idx: integer): integer;
         procedure SetAtNum (idx: integer; value: integer);
         function  GetAtWgt (idx: integer): integer;
         procedure SetAtWgt (idx: integer; value: integer);
         function  GetAtCnt (idx: integer): integer;
         procedure SetAtCnt (idx: integer; value: integer);
         procedure SetAlignment (value: TAlignment);
         procedure SetColorBkg (Value: TColor);
         procedure SetColorTxt (Value: TColor);
         procedure SetNumAtoms (Value: integer);
         function  GetNumAtoms: integer;
         procedure SetIsotVis (x: TIsotVisib);
         procedure SetMolFormula (x: string);
         procedure SetShowAsText (x: boolean);
         procedure SetTransparent (x: boolean);
         procedure SetUseDeuter (x: boolean);
       protected
         procedure Paint; override;
         procedure AssignTo (Dest: TPersistent); override;
       public
         constructor Create(AOwner: TComponent); override;
         destructor  Destroy; override;
         procedure Assign(Source: TPersistent); override;
         function  AsString (fmt: integer): string;
         function  ChemMolWgt: double;
         procedure Clear;
         function  ExactMolWgt: double;
         function  NominalMolWgt: integer;
         function  ScanNextFormPart (Instring: string;
                       var index, AtNr, AtWt, AtNum: integer): boolean;
         property  AtNum[ix: integer]: integer read GetAtNum write SetAtNum;
         property  AtWgt[ix: integer]: integer read GetAtWgt write SetAtWgt;
         property  AtCnt[ix: integer]: integer read GetAtCnt write SetAtCnt;
         property  NumAtoms: integer read GetNumAtoms write SetNumAtoms;
         procedure ShowIt;
         procedure ReadFromString (Instring: string);
         function  CompareTo (OtherFormula: TMolForm): integer;
         function  FindFormulaNominalMass (CheckPlausibility: boolean): boolean;
         function  FindFormulaExactMass (CheckPlausibility: boolean): boolean;
         function  InitFindFormula (mass, tol: double;
                      LowF, HighF: TFormulaRec): boolean;
         procedure ScanMolFormula (mform: string);
       published
         property ColorBkg: TColor read FColorBkg write SetColorBkg;
         property ColorTxt: TColor read FColorTxt write SetColorTxt;
         property Font;
         property IsotopeVis: TIsotVisib read FIsotVis write SetIsotVis;
         property MolFormula: string read GetMolFormula write SetMolFormula;
         property ParentFont;
         property ParentShowHint;
         property ShowAsText: boolean read FShowAsText write SetShowAsText;
         property ShowHint;
{$IFDEF GE_LEV17}
(**)              property StyleElements;
{$ENDIF}
         property Transparent: boolean read FTransparent write SetTransparent;
         property UseDeuterium: boolean read FUseDeuterium write SetUseDeuter;
         property Visible;
         property Alignment: TAlignment read FAlignment write SetALignment;
         property OnClick;
         property OnDblClick;
         property OnMouseMove;
         property OnMouseDown;
         property OnMouseUp;
       end;






Last Update: 2012-Oct-20