if (dgCancelOnExit in Options) and (State = dsInsert) and
not Modified and not FDatalink.FModified then
Cancel else
FDataLink.UpdateData;
except
SetFocus;
raise;
end;
inherited;
end;
procedure TCustomVDBGrid.CMFontChanged(var Message: TMessage);
var
I: Integer;
begin
inherited;
BeginLayout;
try
for I := 0 to Columns.Count-1 do
Columns[I].RefreshDefaultFont;
finally
EndLayout;
end;
end;
procedure TCustomVDBGrid.CMDeferLayout(var Message);
begin
if AcquireLayoutLock then
EndLayout
else
DeferLayout;
end;
procedure TCustomVDBGrid.CMDesignHitTest(var Msg: TCMDesignHitTest);
begin
inherited;
if (Msg.Result = 1) and ((FDataLink = nil) or
((Columns.State = csDefault) and
(FDataLink.DefaultFields or (not FDataLink.Active)))) then
Msg.Result := 0;
end;
procedure TCustomVDBGrid.WMSetCursor(var Msg: TWMSetCursor);
begin
if (csDesigning in ComponentState) and ((FDataLink = nil) or
((Columns.State = csDefault) and
(FDataLink.DefaultFields or (not FDataLink.Active)))) then
Windows.SetCursor(LoadCursor(0, IDC_ARROW))
else inherited;
end;
procedure TCustomVDBGrid.WMSize(var Message: TWMSize);
begin
inherited;
if UpdateLock = 0 then UpdateRowCount;
end;
procedure TCustomVDBGrid.WMVScroll(var Message: TWMVScroll);
var
SI: TScrollInfo;
begin
if FVertical then
begin
inherited ;
Exit;
end;
if not AcquireFocus then Exit;
if FDatalink.Active then
with Message, FDataLink.DataSet do
case ScrollCode of
SB_LINEUP: MoveBy(-FDatalink.ActiveRecord - 1);
SB_LINEDOWN: MoveBy(FDatalink.RecordCount - FDatalink.ActiveRecord);
SB_PAGEUP: MoveBy(-VisibleRowCount);
SB_PAGEDOWN: MoveBy(VisibleRowCount);
SB_THUMBPOSITION:
begin
if IsSequenced then
begin
SI.cbSize := sizeof(SI);
SI.fMask := SIF_ALL;
GetScrollInfo(Self.Handle, SB_VERT, SI);
if SI.nTrackPos <= 1 then First
else if SI.nTrackPos >= RecordCount then Last
else RecNo := SI.nTrackPos;
end
else
case Pos of
0: First;
1: MoveBy(-VisibleRowCount);
2: Exit;
3: MoveBy(VisibleRowCount);
4: Last;
end;
end;
SB_BOTTOM: Last;
SB_TOP: First;
end;
end;
procedure TCustomVDBGrid.WMHScroll(var Message: TWMHScroll);
var
SI: TScrollInfo;
begin
if not FVertical then
begin
inherited ;
Exit;
end;
if not AcquireFocus then Exit;
if FDatalink.Active then
with Message, FDataLink.DataSet do
case ScrollCode of
SB_LINELEFT: MoveBy(-FDatalink.ActiveRecord - 1);
SB_LINERIGHT: MoveBy(FDatalink.RecordCount - FDatalink.ActiveRecord);
SB_PAGEUP: MoveBy(-VisibleColCount);
SB_PAGEDOWN: MoveBy(VisibleColCount);
SB_THUMBPOSITION:
begin
if IsSequenced then
begin
SI.cbSize := sizeof(SI);
SI.fMask := SIF_ALL;
GetScrollInfo(Self.Handle, SB_HORZ, SI);
if SI.nTrackPos <= 1 then First
else if SI.nTrackPos >= RecordCount then Last
else RecNo := SI.nTrackPos;
end
else
case Pos of
0: First;
1: MoveBy(-VisibleColCount);
2: Exit;
3: MoveBy(VisibleColCount);
4: Last;
end;
end;
SB_BOTTOM: Last;
SB_TOP: First;
end;
end;
procedure TCustomVDBGrid.SetIme;
var
Column: TColumn;
begin
if not SysLocale.Fareast then Exit;
if FUpdatingEditor or FDataLink.FInUpdateData then
begin
ImeName := Screen.DefaultIme;
ImeMode := imDontCare;
end
else
begin
Column := Columns[SelectedIndex];
ImeName := FOriginalImeName;
ImeMode := FOriginalImeMode;
if cvImeMode in Column.FAssignedValues then
begin
ImeName := Column.ImeName;
ImeMode := Column.ImeMode;
end;
end;
if InplaceEditor <> nil then
begin
TVDBGridInplaceEdit(Self).ImeName := ImeName;
TVDBGridInplaceEdit(Self).ImeMode := ImeMode;
end;
end;
procedure TCustomVDBGrid.UpdateIme;
begin
if not SysLocale.Fareast then Exit;
SetIme;
if InplaceEditor <> nil then
TVDBGridInplaceEdit(Self).SetIme;
end;
procedure TCustomVDBGrid.WMIMEStartComp(var Message: TMessage);
文章整理:西部数码--专业提供域名注册、虚拟主机服务
http://www.west263.com
以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!




