Subject | [IBO]Jason - loss of focus when tabbing into empty grid - needs resolving |
---|---|
Author | Paul Hope |
Post date | 2007-07-23T13:36:39Z |
Hi Jason
With new versions coming out this issue needs to be resolved.
When tabbing into a connected empty TIB_Grid the focus is not visible.
Pressing tab as many times as there are columns eventually puts the grid
into insert mode.
The trouble lies in TIB_CustomGrid.CMEnter. Dany Marmur has fixed this by
removing 'if not PositionControl...'. I would be quite happy with this if
we knew it wasnt going to cause some other problem - I havent heard any
opinion on this.
My alternative was to copy in the code for scrolling to a new line (see
below). This may be inefficient but it does leave 'if not
PositionControl...' in place to do whatever it was doing.
Any chance you could decide on a solution so the problem isn't perpetuated
into new versions?
Regards
Paul
procedure TIB_CustomGrid.CMEnter( var Message: TCMEnter );
var
AGridCoord: TGridCoord;
begin
inherited;
// It seems a pity to call this on every entry, its only needed
// on the first time after the lookup dataset has been prepared.
// Without this the tabstop may not have been initialised properly.
UpdateColumnAttributes;
// When freshly entering the grid the focused cell is likely not properly
// initialized. Especially with the use of embedded controls.
FFocusedCell.X := -1;
FFocusedCell.Y := -1;
AGridCoord.X := Col;
AGridCoord.Y := Row;
SetFocusedCell( AGridCoord );
if not PositionControl( Col, Row, CellRect( Col, Row )) then
SysUpdateEditor;
// ********added by Paul to fix loss of focus when tabbing into empty grid
with Datalink.BDataset do
begin
if DataLink.EOF and CanInsert and not Self.ReadOnly and
not Self.PreventInserting then
begin
if DataSource.AutoInsert then
begin
CheckPreventModifications;
Append;
end;
end;
end;
// ******end of Paul
end;
[Non-text portions of this message have been removed]
With new versions coming out this issue needs to be resolved.
When tabbing into a connected empty TIB_Grid the focus is not visible.
Pressing tab as many times as there are columns eventually puts the grid
into insert mode.
The trouble lies in TIB_CustomGrid.CMEnter. Dany Marmur has fixed this by
removing 'if not PositionControl...'. I would be quite happy with this if
we knew it wasnt going to cause some other problem - I havent heard any
opinion on this.
My alternative was to copy in the code for scrolling to a new line (see
below). This may be inefficient but it does leave 'if not
PositionControl...' in place to do whatever it was doing.
Any chance you could decide on a solution so the problem isn't perpetuated
into new versions?
Regards
Paul
procedure TIB_CustomGrid.CMEnter( var Message: TCMEnter );
var
AGridCoord: TGridCoord;
begin
inherited;
// It seems a pity to call this on every entry, its only needed
// on the first time after the lookup dataset has been prepared.
// Without this the tabstop may not have been initialised properly.
UpdateColumnAttributes;
// When freshly entering the grid the focused cell is likely not properly
// initialized. Especially with the use of embedded controls.
FFocusedCell.X := -1;
FFocusedCell.Y := -1;
AGridCoord.X := Col;
AGridCoord.Y := Row;
SetFocusedCell( AGridCoord );
if not PositionControl( Col, Row, CellRect( Col, Row )) then
SysUpdateEditor;
// ********added by Paul to fix loss of focus when tabbing into empty grid
with Datalink.BDataset do
begin
if DataLink.EOF and CanInsert and not Self.ReadOnly and
not Self.PreventInserting then
begin
if DataSource.AutoInsert then
begin
CheckPreventModifications;
Append;
end;
end;
end;
// ******end of Paul
end;
[Non-text portions of this message have been removed]