bsp; GetScrollInfo(Self.Handle, SB_HORZ, SIOld) else GetScrollInfo(Self.Handle, SB_VERT, SIOld); SINew := SIOld; if IsSequenced then begin SINew.nMin := 1; SINew.nPage := IIF(FVertical, Self.VisibleColCount, Self.VisibleRowCount); SINew.nMax := RecordCount + SINew.nPage -1; if State in [dsInactive, dsBrowse, dsEdit] then SINew.nPos := RecNo; // else keep old pos end else begin SINew.nMin := 0; SINew.nPage := 0; SINew.nMax := 4; if BOF then SINew.nPos := 0 else if EOF then SINew.nPos := 4 else SINew.nPos := 2; end; if (SINew.nMin <> SIOld.nMin) or (SINew.nMax <> SIOld.nMax) or (SINew.nPage <> SIOld.nPage) or (SINew.nPos <> SIOld.nPos) then if FVertical then SetScrollInfo(Self.Handle, SB_HORZ, SINew, True) else SetScrollInfo(Self.Handle, SB_VERT, SINew, True); end; end;
function TCustomVDBGrid.ValidFieldIndex(FieldIndex: Integer): Boolean; begin Result := DataLink.GetMappedIndex(FieldIndex) >= 0; end;
procedure TCustomVDBGrid.CMParentFontChanged(var Message: TMessage); begin inherited; if ParentFont then begin FSelfChangingTitleFont := True; try TitleFont := Font; finally FSelfChangingTitleFont := False; end; LayoutChanged; end; end;
procedure TCustomVDBGrid.CMExit(var Message: TMessage); begin try if FDatalink.Active then with FDatalink.Dataset do 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
<< 上一页 [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] 下一页 |