With this.ChkBox >>> If Type("this.parent.ControlSource")#"U" >>> .ControlSource = this.parent.ControlSource >>> EndIf >>> .Left = this.parent.Width/2 - .Width/2 >>> If this.Height > .Height >>> .Top = this.parent.Height/2 - .Height/2 >>> EndIf >>>EndWith>>
*CheckBox.Keypress >>Lparameters nKeyCode, nShiftAltCtrl >>With this.parent.parent.parent >> lnRows = int((.Height - (sysmetric(8)+.HeaderHeight))/.RowHeight) >> If nKeyCode = 24 >> Nodefault >> If .RelativeRow = lnRows >> .DoScroll(1) >> Endif >> .ActivateCell(.RelativeRow+1,.RelativeColumn) >> Endif >> If nKeyCode = 5 >> Nodefault >> If .RelativeRow = 1 >> .DoScroll(0) >> Endif >> .ActivateCell(.RelativeRow-1,.RelativeColumn) >> Endif >>EndwithCetin
Define Class grdcheckbox As Container Width = 14 Height = 17 BackStyle = 0 BorderWidth = 0 Name = "grdcheckbox" Add Object check1 As Checkbox With ; Top = 0, ; Left = 0, ; Width = 13, ; BackStyle = 0, ; Caption = "", ; SpecialEffect = 1, ; Name = "Check1" Procedure Init With This .Resize() .check1.ControlSource=.Parent.ControlSource Endwith Endproc Procedure Resize With This.check1 .Left = (This.Parent.Width - .Width)/2 Endwith Endproc Procedure check1.InteractiveChange This.Parent.Parent.Parent.Refresh Endproc Procedure check1.KeyPress Lparameters nKeyCode, nShiftAltCtrl Local lnRows If nKeyCode=32 Replace (this.Controlsource) With !(this.Controlsource) This.Refresh Endif If Inlist(nKeyCode,4,19,5,56,141,24,50,145,18,57,31,3,51,30) Nodefault With This.Parent.Parent.Parent lnRows = (.Height-(.HeaderHeight+Iif( .ScrollBars % 2 = 1, Sysmetric(8),0)))/.RowHeight Do Case Case Inlist(nKeyCode,5,56,141) && Up If !Bof(.RecordSource) Skip -1 In (.RecordSource) Endif If Bof(.RecordSource) Go Top In (.RecordSource) Endif Case Inlist(nKeyCode,24,50,145) && Down If !Eof(.RecordSource) Skip In (.RecordSource) Endif If Eof(.RecordSource) Go Bottom In (.RecordSource) Endif Case Inlist(nKeyCode,18,57,31) && PageUp If !Bof(.RecordSource) Skip -1*lnRows In (.RecordSource) Endif If Bof(.RecordSource) Go Top In (.RecordSource) Endif Case Inlist(nKeyCode,3,51,30) && PageDown If !Eof(.RecordSource) Skip lnRows In (.RecordSource) Endif If Eof(.RecordSource) Go Bottom In (.RecordSource) Endif Case nKeyCode=4 && RightArrow Keyboard("{TAB}") Case nKeyCode=19 && LeftArrow Keyboard("{BACKTAB}") Endcase Endwith Endif Endproc EnddefineCetin