Class TfrmFormula

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type TfrmFormula = class(TfrmCustomGoPhast)

Description

TfrmFormula provides a way for the user to edit formulas

Hierarchy

Overview

Fields

Implicit btn0: TButton;
Implicit btn1: TButton;
Implicit btn2: TButton;
Implicit btn3: TButton;
Implicit btn4: TButton;
Implicit btn5: TButton;
Implicit btn6: TButton;
Implicit btn7: TButton;
Implicit btn8: TButton;
Implicit btn9: TButton;
Implicit btnAnd: TButton;
Implicit btnCancel: TBitBtn;
Implicit btnCloseParen: TButton;
Implicit btnComma: TButton;
Implicit btnDecimal: TButton;
Implicit btnDivide: TButton;
Implicit btnE: TButton;
Implicit btnEquals: TButton;
Implicit btnFalse: TButton;
Implicit btnFunctionHelp: TBitBtn;
Implicit btnGreaterOrEquals: TButton;
Implicit btnGreaterThan: TButton;
Implicit btnHelp: TBitBtn;
Implicit btnLessEquals: TButton;
Implicit btnLessThan: TButton;
Implicit btnMinus: TButton;
Implicit btnMultiply: TButton;
Implicit btnNot: TButton;
Implicit btnNotEqual: TButton;
Implicit btnOK: TBitBtn;
Implicit btnOpenParen: TButton;
Implicit btnOr: TButton;
Implicit btnPlus: TButton;
Implicit btnQuote: TButton;
Implicit btnTrue: TButton;
Implicit btnXor: TButton;
Implicit pnlBottom: TPanel;
Implicit pnlButtons: TPanel;
Implicit pnlLabelItemTree: TPanel;
Implicit pnlMain: TPanel;
Implicit pnlRight: TPanel;
Implicit rbFormulaParser: TRbwParser;
Implicit Splitter: TSplitter;
Implicit Timer: TTimer;
Implicit tvItems: TTreeView;
Implicit tvFormulaDiagram: TTreeView;
Implicit JvNetscapeSplitter1: TJvNetscapeSplitter;
Implicit gbLogicalOperators: TGroupBox;
Implicit gbIntegerOperators: TGroupBox;
Implicit btnMod: TButton;
Implicit btnDiv: TButton;
Implicit gbNumbers: TGroupBox;
Implicit gbOperators: TGroupBox;
Implicit lbltems: TLabel;
Implicit jreFormula: TJvRichEdit;
Private FDataSetGroupName: string;
Private FFunctionHelpString: string;
Private FFunctions: TTreeNode;
Private FLastButton: TButton;
Private FNewSelectionLength: integer;
Private FNewSelectionStart: integer;
Private FResultSet: boolean;
Private FSelectedNode: TTreeNode;
Private FClickSelectionStart: integer;
Private FDiagramObjectStorage: TList;
Private FUpdating: Boolean;
Private FSetColor: Boolean;

Methods

Implicit procedure btnFunctionHelpClick(Sender: TObject);
Implicit procedure btnOKClick(Sender: TObject);
Implicit procedure buttonClick(Sender: TObject);
Implicit procedure FormCreate(Sender: TObject); override;
Implicit procedure FormShow(Sender: TObject);
Implicit procedure jreFormulaChange(Sender: TObject);
Implicit procedure jreFormulaDblClick(Sender: TObject);
Implicit procedure SplitterCanResize(Sender: TObject; var NewSize: Integer; var Accept: Boolean);
Implicit procedure TimerSetSelection(Sender: TObject);
Implicit procedure tvItemsChange(Sender: TObject; Node: TTreeNode);
Implicit procedure tvItemsDblClick(Sender: TObject);
Implicit procedure FormDestroy(Sender: TObject); override;
Implicit procedure tvFormulaDiagramCollapsed(Sender: TObject; Node: TTreeNode);
Implicit procedure tvFormulaDiagramExpanded(Sender: TObject; Node: TTreeNode);
Implicit procedure jreFormulaMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
Implicit procedure jreFormulaSelectionChange(Sender: TObject);
Private function GetFormula: string;
Private procedure InsertText(const NewText: string);
Private procedure SetFormula(const Value: string);
Private procedure DiagramFormula;
Private procedure MatchEndingParen(PriorSelection: TCharRange); overload;
Private procedure MatchStartingParen(PriorSelection: TCharRange); overload;
Private procedure GetGlobalVariables;
Private procedure RemoveSpecialImplementor(AClass: TClass);
Private procedure CreateNodesForVariables;
Public procedure IncludeGIS_Functions(EvalAt: TEvaluatedAt);
Public procedure RemoveActiveOnLayer;
Public procedure RemoveSpecifiedHeadOnLayer;
Public procedure RemoveGetVCont;
Public procedure RemoveHufFunctions;
Public procedure RemoveHufKx;
Public procedure RemoveHufKy;
Public procedure RemoveHufKz;
Public procedure RemoveHufSs;
Public procedure RemoveHufSy;
Public procedure RemoveGIS_Functions;
Public procedure UpdateTreeList;

Properties

Public property DataSetGroupName: string read FDataSetGroupName write FDataSetGroupName;
Public property Formula: string read GetFormula write SetFormula;
Public property ResultSet: boolean read FResultSet;

Description

Fields

Implicit btn0: TButton;

btn0 is used to insert "0" in the formula.

Implicit btn1: TButton;

btn1 is used to insert "1" in the formula.

Implicit btn2: TButton;

btn2 is used to insert "2" in the formula.

Implicit btn3: TButton;

btn3 is used to insert "3" in the formula.

Implicit btn4: TButton;

btn4 is used to insert "4" in the formula.

Implicit btn5: TButton;

btn5 is used to insert "5" in the formula.

Implicit btn6: TButton;

btn6 is used to insert "6" in the formula.

Implicit btn7: TButton;

btn7 is used to insert "7" in the formula.

Implicit btn8: TButton;

btn8 is used to insert "8" in the formula.

Implicit btn9: TButton;

btn9 is used to insert "9" in the formula.

Implicit btnAnd: TButton;

btnAnd is used to insert "and" in the formula.

Implicit btnCancel: TBitBtn;

btnCancel closes the dialog box and sets the ModalResult to mrCancel.

Implicit btnCloseParen: TButton;

btnCloseParen is used to insert ")" in the formula.

Implicit btnComma: TButton;

btnComma is used to insert "," in the formula.

Implicit btnDecimal: TButton;

btnDecimal is used to insert "." in the formula.

Implicit btnDivide: TButton;

btnDivide is used to insert "/" in the formula.

Implicit btnE: TButton;

btnE is used to insert "E" in the formula.

Implicit btnEquals: TButton;

btnEquals is used to insert "=" in the formula.

Implicit btnFalse: TButton;

btnFalse is used to insert "False" in the formula.

Implicit btnFunctionHelp: TBitBtn;

See btnFunctionHelpClick.

Implicit btnGreaterOrEquals: TButton;

btnGreaterOrEquals is used to insert ">-" in the formula.

Implicit btnGreaterThan: TButton;

btnGreaterThan is used to insert ">" in the formula.

Implicit btnHelp: TBitBtn;

btnHelp shows help for the dialog box.

Implicit btnLessEquals: TButton;

btnLessEquals is used to insert "<=" in the formula.

Implicit btnLessThan: TButton;

btnLessThan is used to insert "<" in the formula.

Implicit btnMinus: TButton;

btnMinus is used to insert "-" in the formula.

Implicit btnMultiply: TButton;

btnMultiply is used to insert "*" in the formula.

Implicit btnNot: TButton;

btnNot is used to insert "not" in the formula.

Implicit btnNotEqual: TButton;

btnNotEqual is used to insert "<>" in the formula.

Implicit btnOK: TBitBtn;

See btnOKClick.

Implicit btnOpenParen: TButton;

btnOpenParen is used to insert "(" in the formula.

Implicit btnOr: TButton;

btnOr is used to insert "or" in the formula.

Implicit btnPlus: TButton;

btnPlus is used to insert "+" in the formula.

Implicit btnQuote: TButton;

btnQuote is used to insert '"" in the formula.

Implicit btnTrue: TButton;

btnTrue is used to insert "True" in the formula.

Implicit btnXor: TButton;

btnXor is used to insert "xor" in the formula.

Implicit pnlBottom: TPanel;

pnlBottom is the panel at the bottom of the dialog box.

Implicit pnlButtons: TPanel;

pnlButtons is the panel holding must of the buttons.

Implicit pnlLabelItemTree: TPanel;

pnlLabelItemTree holds a label for tvItems.

Implicit pnlMain: TPanel;

pnlMain holds pnlButtons and jreFormula. It is present to allow Splitter to work properly.

Implicit pnlRight: TPanel;

pnlRight holds tvItems and pnlLabelItemTree.

Implicit rbFormulaParser: TRbwParser;

rbFormulaParser is used to test the validity of the formula.

Implicit Splitter: TSplitter;

Splitter allows the user to resize parts of the dialog box.

Implicit Timer: TTimer;

Timer is used to allow for a slight delay before selecting text in jreFormula.

Implicit tvItems: TTreeView;

tvItems displays the TDataArrays and functions that can be used in the formula.

Implicit tvFormulaDiagram: TTreeView;
 
Implicit JvNetscapeSplitter1: TJvNetscapeSplitter;
 
Implicit gbLogicalOperators: TGroupBox;
 
Implicit gbIntegerOperators: TGroupBox;
 
Implicit btnMod: TButton;

btnMod is used to insert "mod" in the formula.

Implicit btnDiv: TButton;

btnDiv is used to insert "div" in the formula.

Implicit gbNumbers: TGroupBox;
 
Implicit gbOperators: TGroupBox;
 
Implicit lbltems: TLabel;
 
Implicit jreFormula: TJvRichEdit;
 
Private FDataSetGroupName: string;

See DataSetGroupName

Private FFunctionHelpString: string;

FFunctionHelpString is the caption of the TTreeNode in tvItems that was last clicked. It is used to get context sensitive help on Functions displayed in tvItems.

Private FFunctions: TTreeNode;

FFunctions: TTreeNode; FFunctions is the parent TTreeNode that holds all the TTreeNodes for functions.

Private FLastButton: TButton;

FLastButton: TButton; FLastButton is set to the previous button that was clicked. It is used to help determine whether there should be spaces before the the text specified by the button.

Private FNewSelectionLength: integer;

FNewSelectionLength: integer; FNewSelectionLength specifies the length of the text that should be selected in jreFormulaDblClick.

Private FNewSelectionStart: integer;

FNewSelectionStart: integer; FNewSelectionStart specifies the start of the text that should be selected in jreFormulaDblClick.

Private FResultSet: boolean;

FResultSet: boolean; See ResultSet.

Private FSelectedNode: TTreeNode;
 
Private FClickSelectionStart: integer;
 
Private FDiagramObjectStorage: TList;
 
Private FUpdating: Boolean;
 
Private FSetColor: Boolean;
 

Methods

Implicit procedure btnFunctionHelpClick(Sender: TObject);

btnFunctionHelpClick shows help on the function that is selected in tvItems. See tvItemsChange.

Implicit procedure btnOKClick(Sender: TObject);

btnOKClick checks that the formula is valid. If so, it closes the dialog box and sets the ModalResult to mrOK. Otherwise, it disables the OK button.

Implicit procedure buttonClick(Sender: TObject);

buttonClick is the OnClick event handler for most of the buttons in the dialog box. It inserts the caption of the button into the formula.

Implicit procedure FormCreate(Sender: TObject); override;

FormCreate initializes the TfrmFormula.

Implicit procedure FormShow(Sender: TObject);

FormShow calls jreFormula.SetFocus;

Implicit procedure jreFormulaChange(Sender: TObject);

jreFormulaChange enables the OK button.

Implicit procedure jreFormulaDblClick(Sender: TObject);

jreFormulaDblClick determines which a token in the formula should be selected and starts Timer. See TimerSetSelection.

Implicit procedure SplitterCanResize(Sender: TObject; var NewSize: Integer; var Accept: Boolean);

SplitterCanResize ensures that the splitter can't make pnlMain go below its minimum width.

Implicit procedure TimerSetSelection(Sender: TObject);

TimerSetSelection selects the text specified in jreFormulaDblClick and stops Timer.

Implicit procedure tvItemsChange(Sender: TObject; Node: TTreeNode);
 
Implicit procedure tvItemsDblClick(Sender: TObject);
 
Implicit procedure FormDestroy(Sender: TObject); override;
 
Implicit procedure tvFormulaDiagramCollapsed(Sender: TObject; Node: TTreeNode);
 
Implicit procedure tvFormulaDiagramExpanded(Sender: TObject; Node: TTreeNode);
 
Implicit procedure jreFormulaMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);

jreFormulaMouseUp sets FClickSelectionStart.

Implicit procedure jreFormulaSelectionChange(Sender: TObject);
 
Private function GetFormula: string;

See Formula.

Private procedure InsertText(const NewText: string);

InsertText inserts NewText into the formula at the position of the selected text.

Private procedure SetFormula(const Value: string);

See Formula.

Private procedure DiagramFormula;
 
Private procedure MatchEndingParen(PriorSelection: TCharRange); overload;
 
Private procedure MatchStartingParen(PriorSelection: TCharRange); overload;
 
Private procedure GetGlobalVariables;
 
Private procedure RemoveSpecialImplementor(AClass: TClass);
 
Private procedure CreateNodesForVariables;
 
Public procedure IncludeGIS_Functions(EvalAt: TEvaluatedAt);

Private declarations

Public procedure RemoveActiveOnLayer;
 
Public procedure RemoveSpecifiedHeadOnLayer;
 
Public procedure RemoveGetVCont;
 
Public procedure RemoveHufFunctions;
 
Public procedure RemoveHufKx;
 
Public procedure RemoveHufKy;
 
Public procedure RemoveHufKz;
 
Public procedure RemoveHufSs;
 
Public procedure RemoveHufSy;
 
Public procedure RemoveGIS_Functions;

RemoveGIS_Functions sets rbFormulaParser so that only the functions set in TRbwParser.Functions by default are present. GIS functions and any other extra functions are removed.

Public procedure UpdateTreeList;

UpdateTreeList creates the nodes in tvItems.

Properties

Public property DataSetGroupName: string read FDataSetGroupName write FDataSetGroupName;

Name used in the TTreeNode that holds TCustomVariables in tvItems. By default, it is 'Data Sets'.

Public property Formula: string read GetFormula write SetFormula;

use Formula to read or set the formula.

Public property ResultSet: boolean read FResultSet;

ResultSet is set to true if the formula has been successfully changed.


Generated by PasDoc 0.12.1 on 2013-05-13 15:41:35