I am having difficulty using FormControlEditLink because it seems that it always retains focus. For example, if the control is linked to a tadvedit and the advedit is the active inplace editor in the cell, the first click of a command button (eg a tbutton) will end editing of the cell and it takes a subsequent click for the tbutton's onclick handler to fire. This is different from the behavior of the control-specific links you have provided (eg. tadvediteditlink). To see the difference, run the example below and edit a cell in column 1 and then click the tbutton -- the button does not fire on the first click. Repeat in column 2 and you will see that the advediteditlink allows the button's onclick handler to fire.
Is there a setting in Formcontroleditlink that can be changed so that it does not retain focus in this manner?
object Form1: TForm1
Left = 0
Top = 0
Caption = 'Form1'
ClientHeight = 347
ClientWidth = 635
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object AdvStringGrid1: TAdvStringGrid
Left = 56
Top = 8
Width = 400
Height = 250
Cursor = crDefault
BiDiMode = bdLeftToRight
ColCount = 3
DrawingStyle = gdsClassic
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goEditing, goFixedRowClick]
ParentBiDiMode = False
ParentFont = False
ScrollBars = ssBoth
TabOrder = 0
HoverRowCells = [hcNormal, hcSelected]
OnGetEditorType = AdvStringGrid1GetEditorType
ActiveCellFont.Charset = DEFAULT_CHARSET
ActiveCellFont.Color = clWindowText
ActiveCellFont.Height = -11
ActiveCellFont.Name = 'Tahoma'
ActiveCellFont.Style = [fsBold]
ColumnHeaders.Strings = (
''
'Formcontroleditlink'
'AdvEditEditLink')
ControlLook.FixedGradientHoverFrom = clGray
ControlLook.FixedGradientHoverTo = clWhite
ControlLook.FixedGradientDownFrom = clGray
ControlLook.FixedGradientDownTo = clSilver
ControlLook.DropDownHeader.Font.Charset = DEFAULT_CHARSET
ControlLook.DropDownHeader.Font.Color = clWindowText
ControlLook.DropDownHeader.Font.Height = -11
ControlLook.DropDownHeader.Font.Name = 'Tahoma'
ControlLook.DropDownHeader.Font.Style = []
ControlLook.DropDownHeader.Visible = True
ControlLook.DropDownHeader.Buttons = <>
ControlLook.DropDownFooter.Font.Charset = DEFAULT_CHARSET
ControlLook.DropDownFooter.Font.Color = clWindowText
ControlLook.DropDownFooter.Font.Height = -11
ControlLook.DropDownFooter.Font.Name = 'Tahoma'
ControlLook.DropDownFooter.Font.Style = []
ControlLook.DropDownFooter.Visible = True
ControlLook.DropDownFooter.Buttons = <>
Filter = <>
FilterDropDown.Font.Charset = DEFAULT_CHARSET
FilterDropDown.Font.Color = clWindowText
FilterDropDown.Font.Height = -11
FilterDropDown.Font.Name = 'Tahoma'
FilterDropDown.Font.Style = []
FilterDropDown.TextChecked = 'Checked'
FilterDropDown.TextUnChecked = 'Unchecked'
FilterDropDownClear = '(All)'
FilterEdit.TypeNames.Strings = (
'Starts with'
'Ends with'
'Contains'
'Not contains'
'Equal'
'Not equal'
'Larger than'
'Smaller than'
'Clear')
FixedRowHeight = 22
FixedFont.Charset = DEFAULT_CHARSET
FixedFont.Color = clWindowText
FixedFont.Height = -11
FixedFont.Name = 'Tahoma'
FixedFont.Style = [fsBold]
FloatFormat = '%.2f'
HoverButtons.Buttons = <>
HoverButtons.Position = hbLeftFromColumnLeft
HTMLSettings.ImageFolder = 'images'
HTMLSettings.ImageBaseName = 'img'
MouseActions.DirectEdit = True
PrintSettings.DateFormat = 'dd/mm/yyyy'
PrintSettings.Font.Charset = DEFAULT_CHARSET
PrintSettings.Font.Color = clWindowText
PrintSettings.Font.Height = -11
PrintSettings.Font.Name = 'Tahoma'
PrintSettings.Font.Style = []
PrintSettings.FixedFont.Charset = DEFAULT_CHARSET
PrintSettings.FixedFont.Color = clWindowText
PrintSettings.FixedFont.Height = -11
PrintSettings.FixedFont.Name = 'Tahoma'
PrintSettings.FixedFont.Style = []
PrintSettings.HeaderFont.Charset = DEFAULT_CHARSET
PrintSettings.HeaderFont.Color = clWindowText
PrintSettings.HeaderFont.Height = -11
PrintSettings.HeaderFont.Name = 'Tahoma'
PrintSettings.HeaderFont.Style = []
PrintSettings.FooterFont.Charset = DEFAULT_CHARSET
PrintSettings.FooterFont.Color = clWindowText
PrintSettings.FooterFont.Height = -11
PrintSettings.FooterFont.Name = 'Tahoma'
PrintSettings.FooterFont.Style = []
PrintSettings.PageNumSep = '/'
SearchFooter.FindNextCaption = 'Find &next'
SearchFooter.FindPrevCaption = 'Find &previous'
SearchFooter.Font.Charset = DEFAULT_CHARSET
SearchFooter.Font.Color = clWindowText
SearchFooter.Font.Height = -11
SearchFooter.Font.Name = 'Tahoma'
SearchFooter.Font.Style = []
SearchFooter.HighLightCaption = 'Highlight'
SearchFooter.HintClose = 'Close'
SearchFooter.HintFindNext = 'Find next occurrence'
SearchFooter.HintFindPrev = 'Find previous occurrence'
SearchFooter.HintHighlight = 'Highlight occurrences'
SearchFooter.MatchCaseCaption = 'Match case'
SortSettings.DefaultFormat = ssAutomatic
Version = '7.8.9.0'
ColWidths = (
64
127
126)
end
object Button1: TButton
Left = 72
Top = 286
Width = 75
Height = 25
Caption = 'Button1'
TabOrder = 1
OnClick = Button1Click
end
object AdvEdit1: TAdvEdit
Left = 184
Top = 288
Width = 121
Height = 21
EmptyTextStyle = []
LabelFont.Charset = DEFAULT_CHARSET
LabelFont.Color = clWindowText
LabelFont.Height = -11
LabelFont.Name = 'Tahoma'
LabelFont.Style = []
Lookup.Font.Charset = DEFAULT_CHARSET
Lookup.Font.Color = clWindowText
Lookup.Font.Height = -11
Lookup.Font.Name = 'Arial'
Lookup.Font.Style = []
Lookup.Separator = ';'
Color = clWindow
TabOrder = 2
Text = 'AdvEdit1'
Visible = True
Version = '3.3.6.1'
end
object FormControlEditLink1: TFormControlEditLink
Tag = 0
WantKeyLeftRight = False
WantKeyUpDown = False
WantKeyHomeEnd = False
WantKeyPriorNext = False
Control = AdvEdit1
Left = 360
Top = 280
end
object AdvEditEditLink1: TAdvEditEditLink
Tag = 0
WantKeyLeftRight = True
WantKeyUpDown = False
WantKeyHomeEnd = True
WantKeyPriorNext = False
EditAlign = eaLeft
EditColor = clWindow
MaxLength = 0
ModifiedColor = clRed
EditType = etString
ShowModified = False
Precision = 0
Signed = False
ExcelStyleDecimalSeparator = False
Left = 456
Top = 288
end
end
unit Unit1;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.Grids, AdvObj, BaseGrid, AdvGrid,
Vcl.StdCtrls, frmctrllink, AsgLinks, Vcl.Mask, JvExMask, JvToolEdit, AdvEdit;
type
TForm1 = class(TForm)
AdvStringGrid1: TAdvStringGrid;
FormControlEditLink1: TFormControlEditLink;
Button1: TButton;
AdvEdit1: TAdvEdit;
AdvEditEditLink1: TAdvEditEditLink;
procedure Button1Click(Sender: TObject);
procedure AdvStringGrid1GetEditorType(Sender: TObject; ACol, ARow: Integer;
var AEditor: TEditorType);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.AdvStringGrid1GetEditorType(Sender: TObject;
ACol, ARow: Integer; var AEditor: TEditorType);
begin
AEditor := edCustom;
Case ACol of
1:
begin
AdvStringGrid1.EditLink := FormControlEditLink1;
end;
2:
begin
AdvStringGrid1.EditLink := AdvEditEditLink1;
end;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
ShowMessage('clicked');
end;
end.