Scale on keyboard and piano roll??

Is there a way to limit the keys to a particular scale? Thanks.