* Toolbar.cmdAddNew.Click() If type("_screen.activeform")<>"O" thisform.stop() && makes disable controls RETURN .t. ENDIF _screen.ActiveForm.AddNew()i think your keypress event code will solve my problem and i don't need to use on key label f2 oToolbar.cmdaddnew.click() command at loadevent and for release it on destroy event . isn't it ?
* Form.KeyPress( nKeycode, nShiftAltCtrl ) if ( nKeyCode = -1 ) && F2 this.AddNew() nodefault && prevent the key from being seen by the current ActiveControl endif return dodefault( nKeycode, nShiftAltCtrl )