************************************************** *-- Class: numberpad (c:\temp\keyclickbuttons.vcx) *-- ParentClass: container *-- BaseClass: container * DEFINE CLASS numberpad AS container Width = 72 Height = 131 BorderWidth = 0 Name = "numberpad" clicked = .F. ADD OBJECT text1 AS textbox WITH ; Height = 23, ; Left = 0, ; Top = 108, ; Width = 72, ; Name = "Text1" ADD OBJECT cmdkeyclickbutton1 AS cmdkeyclickbutton WITH ; Top = 0, ; Left = 0, ; Name = "Cmdkeyclickbutton1" ADD OBJECT cmdkeyclickbutton2 AS cmdkeyclickbutton WITH ; Top = 0, ; Left = 24, ; Name = "Cmdkeyclickbutton2" PROCEDURE text1.KeyPress LPARAMETERS nKeyCode, nShiftAltCtrl && Trap keys 0-9 if this keystroke didn't come from a mouseclick *wait window str(nkeycode) if between(nKeyCode, 48, 57) and nShiftAltCtrl = 0 and ; ! this.parent.Clicked *Stuff the keyboard with ALT+KEY combination c = '{ALT+' + chr(nKeyCode)+'}' keyboard(c) *Eliminate the initial key that was press from displaying nodefault this.parent.clicked = .t. else this.parent.clicked = .f. endif ENDPROC ENDDEFINE * *-- EndDefine: numberpad ************************************************** ************************************************** *-- Class: cmdkeyclickbutton (c:\temp\keyclickbuttons.vcx) *-- ParentClass: commandbutton *-- BaseClass: commandbutton * DEFINE CLASS cmdkeyclickbutton AS commandbutton Height = 26 Width = 24 Caption = "" TabStop = .F. Name = "cmdkeyclickbutton" PROCEDURE Click * Stuff the keyboard with the last character of the * caption of this button keyboard(right(this.caption, 1)) this.parent.text1.setfocus() ENDPROC PROCEDURE MouseUp LPARAMETERS nButton, nShift, nXCoord, nYCoord * Set the "MouseClick" flag to prevent an endless loop * between the text.keypress, and button.click oObject = sys(1270) if oObject.name = this.name this.parent.Clicked = .t. else this.parent.Clicked = .f. endif ENDPROC PROCEDURE Init * Set caption based on the last character of * this object's name this.caption = '\<' + right(this.name, 1) ENDPROC ENDDEFINE * *-- EndDefine: cmdkeyclickbutton **************************************************>Hi All,