Button
Description
The component is used to perform actions when the user clicks on it.
Class: TdbButton
Properties
Property |
Type |
Description |
dbGeneralTableId |
Integer |
Makes sense if the button has the "Save record" action assigned to it. Contains the record id, if the record is not saved, it returns -1. |
dbGeneralTable |
String |
It makes sense if the button has a "Search", "Save Record" or "Report" action. Contains the name of the main database table. |
dbGetSqlStatement |
String |
Makes sense if the button has a "Search" or "Report" action. Contains the last automatically generated SQL query. |
dbParentTableId |
Integer |
Makes sense if the button has a "Save record" action. Contains the id of the child record, if the record is not saved, it returns -1. |
dbParentTable |
Integer |
Makes sense if the button has a "Save record" action. Contains the name of the child database table. |
dbSQL |
String |
It makes sense if the button has an "SQL query" or "Report (SQL)" action assigned to it. To access the SQL query. |
dbFilter |
String |
Makes sense if the button has a "Search" or "Report" action. Allows you to set an additional filter for a query to the database. For example: tablename.fieldname = 1 |
dbReportFile |
String |
Makes sense if the button has a Report or Report (SQL) action assigned to it. Name of the template file for the report. If the absolute path of the file is not specified, it means that the file is located in the Report folder of your project. |
dbReportResultFile |
String |
Makes sense if the button has a Report or Report (SQL) action assigned to it. Allows you to set the file name for the generated report. |
dbReportOpenIn |
TReportOpenIn |
Makes sense if the button has a Report or Report (SQL) action assigned to it. Allows you to set the action after the report is created. Values: rpoPreview, rpoPrint, rpoPrintQuick, rpoExcel, rpoWord, rpoPDF, rpoHTML, rpoODT, rpoODS, rpoJPEG, rpoTIFF, rpoDesigner |
dbActionType |
TActionDbType |
Defines the action of the button. Available values: adbNone, adbSearch, adbNewRecord, adbSaveRecord, adbShowRecord, adbDelete, adbSQL, adbReportNoSQL, adbReport, adbShowForm, adbCloseForm, adbGridToExcel |
dbDoCloseForm |
Boolean |
Makes sense if the button has a "Save Record" action assigned to it. Determines whether the form will be closed after the button is clicked. |
dbDontResetID |
Boolean |
Makes sense if the button has a "Save Record" action assigned to it. Determines whether the record id in the dbGeneralTableId property will be saved after the record is saved. |
Cancel |
Boolean |
Determines whether the button is automatically pressed when the user on the form presses the Escape button. |
CanFocus |
Boolean |
It checks if the component can get input focus, which is usually necessary before using the SetFocus method. If a component has Visible = False or Enabled = False property, or if the component is located on a parent component with those properties, using the SetFocus method will cause an error. example: if Form1.Button1.CanFocus then Form1.Button1.SetFocus; |
TCursor |
Specifies the image used to represent the mouse pointer when it passes into the region covered by the control. More info. |
|
Caption |
String |
Specifies a text string that identifies the control to the user. |
Default |
Boolean |
Determines whether the button is automatically pressed when the Enter key is pressed if the input focus is located in a component for entering information. |
Enabled |
Boolean |
Controls whether the component responds to mouse, keyboard, and timer events. |
Focused |
Boolean |
Determines whether the control has input focus. |
TFont |
Allows you to set font name, size, color and style. More info. |
|
Hint |
String |
Hint contains the text string that appears when the user moves the mouse over the component., see also ShowHint |
ImageMargins |
TImageMargins |
Margins of image on button. Example: Form1.Button1.ImageMargins.Left := 10; available properties: Left, Top, Right, Bottom |
Name |
String |
The name of the component. |
ShowHint |
Boolean |
Specifies whether to show the Help Hint when the mouse pointer moves over the component, see also Hint |
Tag |
Integer |
Allows you to assign a number to a component for your own needs. |
TagString |
String |
Allows you to assign a string to a component for your own needs. |
TabOrder |
Integer |
Indicates the position of the component in its parent's tab order. TabOrder is the order in which child components are visited when the user presses the Tab key. |
TabStop |
Boolean |
Determines whether the user can tab to a control. Use the TabStop to allow or disallow access to the control using the Tab key. |
Visible |
Boolean |
Specifies whether the component appears onscreen. |
WordWrap |
Boolean |
Specifies whether the button text wraps to fit the width of the control. |
Left |
Integer |
Specifies the horizontal coordinate of the left edge of a component relative to its parent. |
Top |
Integer |
Specifies the vertical coordinate of the upper-left of a component relative to its parent. |
Width |
Integer |
Specifies the horizontal size of the component in pixels. |
Height |
Integer |
Specifies the vertical size of the component in pixels. |
Methods
Method |
Description |
procedure Click |
Allows you to click the button, thereby performing the action specified in the Action (dbActionType) property, as well as in the OnClick and OnAfterClick events |
procedure SetFocus |
Gives the input focus to the component. |
Events
Event |
Description |
Occurs when the user clicks the component. The event also allows you to prevent the selected action for the button. More info. |
|
OnAfterClick |
Occurs when you click on the component after the action specified for the button. If no action is specified for the button, the event is not called. |
OnEnter |
Occurs when a component receives the input focus. |
OnExit |
Occurs when the input focus shifts away from one component to another. |
OnKeyDown |
Occurs when a user presses any key while the form has focus. |
OnKeyPress |
Occurs when a key is pressed. Note that this procedure handles printable characters only. |
OnKeyUp |
Occurs when the user releases a key that was pressed. |
OnMouseDown |
Occurs when the user presses a mouse button with the mouse pointer over a component. |
OnMouseEnter |
Occurs when the user moves the mouse into a component. |
OnMouseLeave |
Occurs when the user moves the mouse outside of a component. |
OnMouseMove |
Occurs when the user moves the mouse pointer while the mouse pointer is over a component. |
OnMouseUp |
Occurs when the user releases a mouse button that was pressed with the mouse pointer over a component. |
Occurs when user tries to drag and drop a file from explorer to a form. More info. |