This topic contains a sample script routine that demonstrates illustrates how to check TDBGrid options from scripts. The example requires a Delphi Open Application with a form and a TDBGrid
object on it. The application must be compiled with debug information (see Debug Info Agent).
JavaScript, JScript
function Test()
{
var dgEditing = 0,
dgAlwaysShowEditor = 1,
dgTitles = 2,
dgIndicator = 3,
dgColumnResize = 4,
dgColLines = 5,
dgRowLines = 6,
dgTabs = 7,
dgRowSelect = 8,
dgAlwaysShowSelection = 9,
dgConfirmDelete = 10,
dgCancelOnExit = 11,
dgMultiSelect = 12,
dgTitleClick = 13,
dgTitleHotTrack = 14;
var grid = Sys.Process("MastApp").VCLObject("BrCustOrdForm").VCLObject("OrdersGrid");
var opt = grid.Options;
var s = "";
if (InSet(dgEditing, opt))
s += "dgEditing: Editing is possible." + "\r\n";
if (InSet(dgAlwaysShowEditor, opt))
s += "dgAlwaysShowEditor: The grid is always in edit mode." + "\r\n";
if (InSet(dgTitles, opt))
s += "dgTitles: Titles appear at the top of the columns." + "\r\n";
if (InSet(dgIndicator, opt))
s += "dgIndicator: Indicator is visible." + "\r\n";
if (InSet(dgColumnResize, opt))
s += "dgColumnResize: Column width is resizable." + "\r\n";
if (InSet(dgColLines, opt))
s += "dgColLines: Lines appear between columns in the grid." + "\r\n";
if (InSet(dgRowLines, opt))
s += "dgRowLines: Lines appear between the rows of the grid." + "\r\n";
if (InSet(dgTabs, opt))
s += "dgTabs: Tab key navigation is enabled." + "\r\n";
if (InSet(dgRowSelect, opt))
s += "dgRowSelect: The entire row can be selected." + "\r\n";
if (InSet(dgAlwaysShowSelection, opt))
s += "dgAlwaysShowSelection: The selected cell is always shown." + "\r\n";
if (InSet(dgConfirmDelete, opt))
s += "dgConfirmDelete: A confirmation message appears when trying to delete a row." + "\r\n";
if (InSet(dgCancelOnExit, opt))
s += "dgCancelOnExit: The changes are not posted when the grid loses focus." + "\r\n";
if (InSet(dgMultiSelect, opt))
s += "dgMultiSelect: More than one row can be selected." + "\r\n";
if (InSet(dgTitleClick, opt))
s += "dgTitleClick: Clicking in the cells of the table header is allowed." + "\r\n";
if (InSet(dgTitleHotTrack, opt))
s += "dgTitleHotTrack: The list items are highlighted when the mouse is over them." + "\r\n";
Log.Message("Grid options (see Details)", s);
}
Python
def Test():
dgEditing = 0
dgAlwaysShowEditor = 1
dgTitles = 2
dgIndicator = 3
dgColumnResize = 4
dgColLines = 5
dgRowLines = 6
dgTabs = 7
dgRowSelect = 8
dgAlwaysShowSelection = 9
dgConfirmDelete = 10
dgCancelOnExit = 11
dgMultiSelect = 12
dgTitleClick = 13
dgTitleHotTrack = 14
grid = Sys.Process("MastApp").VCLObject("BrCustOrdForm").VCLObject("OrdersGrid")
opt = grid.Options
s = ""
if InSet(dgEditing, opt):
s += "dgEditing: Editing is possible." + "\r\n"
if InSet(dgAlwaysShowEditor, opt):
s += "dgAlwaysShowEditor: The grid is always in edit mode." + "\r\n"
if InSet(dgTitles, opt):
s += "dgTitles: Titles appear at the top of the columns." + "\r\n"
if InSet(dgIndicator, opt):
s += "dgIndicator: Indicator is visible." + "\r\n"
if InSet(dgColumnResize, opt):
s += "dgColumnResize: Column width is resizable." + "\r\n"
if InSet(dgColLines, opt):
s += "dgColLines: Lines appear between columns in the grid." + "\r\n"
if InSet(dgRowLines, opt):
s += "dgRowLines: Lines appear between the rows of the grid." + "\r\n"
if InSet(dgTabs, opt):
s += "dgTabs: Tab key navigation is enabled." + "\r\n"
if InSet(dgRowSelect, opt):
s += "dgRowSelect: The entire row can be selected." + "\r\n"
if InSet(dgAlwaysShowSelection, opt):
s += "dgAlwaysShowSelection: The selected cell is always shown." + "\r\n"
if InSet(dgConfirmDelete, opt):
s += "dgConfirmDelete: A confirmation message appears when trying to delete a row." + "\r\n"
if InSet(dgCancelOnExit, opt):
s += "dgCancelOnExit: The changes are not posted when the grid loses focus." + "\r\n"
if InSet(dgMultiSelect, opt):
s += "dgMultiSelect: More than one row can be selected." + "\r\n"
if InSet(dgTitleClick, opt):
s += "dgTitleClick: Clicking in the cells of the table header is allowed." + "\r\n"
if InSet(dgTitleHotTrack, opt):
s += "dgTitleHotTrack: The list items are highlighted when the mouse is over them." + "\r\n"
Log.Message("Grid options (see Details)", s)
VBScript
Sub Test
Const dgEditing = 0
Const dgAlwaysShowEditor = 1
Const dgTitles = 2
Const dgIndicator = 3
Const dgColumnResize = 4
Const dgColLines = 5
Const dgRowLines = 6
Const dgTabs = 7
Const dgRowSelect = 8
Const dgAlwaysShowSelection = 9
Const dgConfirmDelete = 10
Const dgCancelOnExit = 11
Const dgMultiSelect = 12
Const dgTitleClick = 13
Const dgTitleHotTrack = 14
Dim grid, opt, s
Set grid = Sys.Process("MastApp").VCLObject("BrCustOrdForm").VCLObject("OrdersGrid")
opt = grid.Options
s = ""
If InSet(dgEditing, opt) Then
s = s & "dgEditing: Editing is possible." & vbNewLine
End If
If InSet(dgAlwaysShowEditor, opt) Then
s = s & "dgAlwaysShowEditor: The grid is always in edit mode." & vbNewLine
End If
If InSet(dgTitles, opt) Then
s = s & "dgTitles: Titles appear at the top of the columns." & vbNewLine
End If
If InSet(dgIndicator, opt) Then
s = s & "dgIndicator: Indicator is visible." & vbNewLine
End If
If InSet(dgColumnResize, opt) Then
s = s & "dgColumnResize: Column width is resizable." & vbNewLine
End If
If InSet(dgColLines, opt) Then
s = s & "dgColLines: Lines appear between columns in the grid." & vbNewLine
End If
If InSet(dgRowLines, opt) Then
s = s & "dgRowLines: Lines appear between the rows of the grid." & vbNewLine
End If
If InSet(dgTabs, opt) Then
s = s & "dgTabs: Tab key navigation is enabled." & vbNewLine
End If
If InSet(dgRowSelect, opt) Then
s = s & "dgRowSelect: The entire row can be selected." & vbNewLine
End If
If InSet(dgAlwaysShowSelection, opt) Then
s = s & "dgAlwaysShowSelection: The selected cell is always shown." & vbNewLine
End If
If InSet(dgConfirmDelete, opt) Then
s = s & "dgConfirmDelete: A confirmation message appears when trying to delete a row." & vbNewLine
End If
If InSet(dgCancelOnExit, opt) Then
s = s & "dgCancelOnExit: The changes are not posted when the grid loses focus." & vbNewLine
End If
If InSet(dgMultiSelect, opt) Then
s = s & "dgMultiSelect: More than one row can be selected." & vbNewLine
End If
If InSet(dgTitleClick, opt) Then
s = s & "dgTitleClick: Clicking in the cells of the table header is allowed." & vbNewLine
End If
If InSet(dgTitleHotTrack, opt) Then
s = s & "dgTitleHotTrack: The list items are highlighted when the mouse is over them." & vbNewLine
End If
Log.Message "Grid options (see Details)", s
End Sub
DelphiScript
procedure Test;
const
dgEditing = 0;
dgAlwaysShowEditor = 1;
dgTitles = 2;
dgIndicator = 3;
dgColumnResize = 4;
dgColLines = 5;
dgRowLines = 6;
dgTabs = 7;
dgRowSelect = 8;
dgAlwaysShowSelection = 9;
dgConfirmDelete = 10;
dgCancelOnExit = 11;
dgMultiSelect = 12;
dgTitleClick = 13;
dgTitleHotTrack = 14;
var
grid, opt, s;
begin
grid := Sys.Process('MastApp').VCLObject('BrCustOrdForm').VCLObject('OrdersGrid');
opt := grid.Options;
s := '';
if InSet(dgEditing, opt) then
s := s + 'dgEditing: Editing is possible.' + #13#10;
if InSet(dgAlwaysShowEditor, opt) then
s := s + 'dgAlwaysShowEditor: The grid is always in edit mode.' + #13#10;
if InSet(dgTitles, opt) then
s := s + 'dgTitles: Titles appear at the top of the columns.' + #13#10;
if InSet(dgIndicator, opt) then
s := s + 'dgIndicator: Indicator is visible.' + #13#10;
if InSet(dgColumnResize, opt) then
s := s + 'dgColumnResize: Column width is resizable.' + #13#10;
if InSet(dgColLines, opt) then
s := s + 'dgColLines: Lines appear between columns in the grid.' + #13#10;
if InSet(dgRowLines, opt) then
s := s + 'dgRowLines: Lines appear between the rows of the grid.' + #13#10;
if InSet(dgTabs, opt) then
s := s + 'dgTabs: Tab key navigation is enabled.' + #13#10;
if InSet(dgRowSelect, opt) then
s := s + 'dgRowSelect: The entire row can be selected.' + #13#10;
if InSet(dgAlwaysShowSelection, opt) then
s := s + 'dgAlwaysShowSelection: The selected cell is always shown.' + #13#10;
if InSet(dgConfirmDelete, opt) then
s := s + 'dgConfirmDelete: A confirmation message appears when trying to delete a row.' + #13#10;
if InSet(dgCancelOnExit, opt) then
s := s + 'dgCancelOnExit: The changes are not posted when the grid loses focus.' + #13#10;
if InSet(dgMultiSelect, opt) then
s := s + 'dgMultiSelect: More than one row can be selected.' + #13#10;
if InSet(dgTitleClick, opt) then
s := s + 'dgTitleClick: Clicking in the cells of the table header is allowed.' + #13#10;
if InSet(dgTitleHotTrack, opt) then
s := s + 'dgTitleHotTrack: The list items are highlighted when the mouse is over them.' + #13#10;
Log.Message('Grid options (see Details)', s);
end;
C++Script, C#Script
function Test()
{
var dgEditing = 0,
dgAlwaysShowEditor = 1,
dgTitles = 2,
dgIndicator = 3,
dgColumnResize = 4,
dgColLines = 5,
dgRowLines = 6,
dgTabs = 7,
dgRowSelect = 8,
dgAlwaysShowSelection = 9,
dgConfirmDelete = 10,
dgCancelOnExit = 11,
dgMultiSelect = 12,
dgTitleClick = 13,
dgTitleHotTrack = 14;
var grid = Sys["Process"]("MastApp")["VCLObject"]("BrCustOrdForm")["VCLObject"]("OrdersGrid");
var opt = grid["Options"];
var s = "";
if (InSet(dgEditing, opt))
s += "dgEditing: Editing is possible." + "\r\n";
if (InSet(dgAlwaysShowEditor, opt))
s += "dgAlwaysShowEditor: The grid is always in edit mode." + "\r\n";
if (InSet(dgTitles, opt))
s += "dgTitles: Titles appear at the top of the columns." + "\r\n";
if (InSet(dgIndicator, opt))
s += "dgIndicator: Indicator is visible." + "\r\n";
if (InSet(dgColumnResize, opt))
s += "dgColumnResize: Column width is resizable." + "\r\n";
if (InSet(dgColLines, opt))
s += "dgColLines: Lines appear between columns in the grid." + "\r\n";
if (InSet(dgRowLines, opt))
s += "dgRowLines: Lines appear between the rows of the grid." + "\r\n";
if (InSet(dgTabs, opt))
s += "dgTabs: Tab key navigation is enabled." + "\r\n";
if (InSet(dgRowSelect, opt))
s += "dgRowSelect: The entire row can be selected." + "\r\n";
if (InSet(dgAlwaysShowSelection, opt))
s += "dgAlwaysShowSelection: The selected cell is always shown." + "\r\n";
if (InSet(dgConfirmDelete, opt))
s += "dgConfirmDelete: A confirmation message appears when trying to delete a row." + "\r\n";
if (InSet(dgCancelOnExit, opt))
s += "dgCancelOnExit: The changes are not posted when the grid loses focus." + "\r\n";
if (InSet(dgMultiSelect, opt))
s += "dgMultiSelect: More than one row can be selected." + "\r\n";
if (InSet(dgTitleClick, opt))
s += "dgTitleClick: Clicking in the cells of the table header is allowed." + "\r\n";
if (InSet(dgTitleHotTrack, opt))
s += "dgTitleHotTrack: The list items are highlighted when the mouse is over them." + "\r\n";
Log["Message"]("Grid options (see Details)", s);
}