... my code and I tried this : oDlg:bNCActivate := {|lOnOff| IF(lOnOff,KEY_ON(),KEY_OFF())} This results in hanging my application when the dialog box loses the focus. Then I changed my code one again : oDlg:bNCActivate := {|lOnOff| IF(lOnOff,KEY_ON(),)} ...