Keyboard / lock / latch notes

Is there a way to create a button to lock / latch notes played from keyboard widget ?