Formula Bar Control
- 3 minutes to read
The ExpressSpreadSheet Formula Bar Control (the Formula Bar control, for short) implemented as the TdxSpreadSheetFormulaBar component is designed to complement the Spreadsheet and Report Designer controls with additional cell view and edit options found in many popular spreadsheet applications.
The Formula Bar always shows its core UI element – the Formula Editor that shows or edits the focused cell’s content, and provides the Formula AutoComplete functionality that aids end users in composing formula expressions by suggesting registered functions and available defined names that match the typed portion of a recognized name.
Two optional UI elements are the “Name” and “Button” boxes that provide additional cell selection and edit options. The Name Box aids end users in determining the active (focused) cell’s position and track the dimensions of a cell range that is currently being selected by dragging the mouse:
When focused, the Name Box allows you to type a reference to a cell or cell range to select it in the active worksheet, or create a defined name referring to the current cell selection. If a defined name is already assigned to a cell or cell range, an end user can select it by clicking the name in the Name box’s dropdown list.
The Button Box lists the “Cancel”, “Enter”, and “Insert Function” buttons. The first two buttons are enabled only when the Edit box is focused:
The Cancel button discards the current user input and returns focus to the spreadsheet control associated with the Formula Bar. A click on this button is equivalent to the Esc key press;
The Enter button returns focus to the active cell in the associated spreadsheet control and posts the current user input to the cell. An Enter key press produces the same effect.
The “Insert Function” button is enabled when an in-place cell editor or the Formula Bar’s Edit box is inactive, or when the active editor’s content starts with the equal sign. A click on this button invokes the “Insert Function“ dialog that allows end users to pick a built-in function to use it in a formula expression from the full list (that is, the “All” category) or a specific function category (“Compatibility”, for example):
Note that the Shift+F3 key combination invokes the “Insert Function” dialog under the same conditions.
The following table lists key public API members that the TdxSpreadSheetFormulaBar component provides:
Contents | Use the SpreadSheet property to select a target Spreadsheet or Report Designer control for the Formula Bar. The Formula Bar is disabled if this property is set to nil. Note If you create a new Formula Bar at design time, it automatically associates with the spreadsheet control that is placed first on the same application form. |
Appearance | Use the LookAndFeel, OptionsView, and Transparent properties to customize the Formula Bar’s appearance. Additionally, the CustomHeight property allows you to resize the control vertically if a splitter control separates it from the rest of the application’s form resizeable content (such as a spreadsheet control, for instance). |
Behavior | Use the OptionsBehavior.FormulaAutoComplete and OptionsBehavior.FormulaAutoCompleteShowHint properties to override the associated spreadsheet control’s corresponding Formula AutoComplete settings accessible via the OptionsBehavior property. |
Layout | Use the OptionsView.ShowButtons, OptionsView.ShowNameBox, SeparatorPosition, and Expanded property to hide or show optional UI elements, and change their size within the Formula Bar. |