The easiest scenario would be calling the following piece of code when the player presses "OK" on your settings dialog:
var Editor = self.GetWidget("sub_speed");
var Number = ToInt(Editor.Text);
if(Number < 40) Number = 40;
if(Number > 150) Number = 150;
if(Number!=Editor.Text) Editor.Text = Number;
(providing your editor is called "sub_speed")
You could also check the validity "online" (while the player types the number in), because everytime the editor contents are changed, the parent window recieves an event (with the same name as the editor's name) but that would be more complicated and it's probably not necessary.