Further slightly enhancing the above, so that enter keys work properly depending on where you're typing:
Code:
//--- Set event handlers
DEBUG_DISPLAY displayaddeventhandler ["keydown","
_key = _this select 1;
_ctrl = _this select 3;
if (_ctrl) then {
switch (_key) do {
case 2: {call compile (ctrlText 316101);};
case 3: {call compile (ctrlText 316102);};
case 4: {call compile (ctrlText 316103);};
case 5: {call compile (ctrlText 316104);};
case 6: {call compile (ctrlText 316105);};
case 7: {call compile (ctrlText 316106);};
};
};
false
"];
//--- Set event handlers per control to react to enter keys
DEBUG_CMD1 ctrlAddEventHandler ["keydown","_key=_this select 1;if (_key == 28 || _key == 156) then {call compile (ctrlText 316101)};"];
DEBUG_CMD2 ctrlAddEventHandler ["keydown","_key=_this select 1;if (_key == 28 || _key == 156) then {call compile (ctrlText 316102)};"];
DEBUG_CMD3 ctrlAddEventHandler ["keydown","_key=_this select 1;if (_key == 28 || _key == 156) then {call compile (ctrlText 316103)};"];
DEBUG_CMD4 ctrlAddEventHandler ["keydown","_key=_this select 1;if (_key == 28 || _key == 156) then {call compile (ctrlText 316104)};"];
DEBUG_CMD5 ctrlAddEventHandler ["keydown","_key=_this select 1;if (_key == 28 || _key == 156) then {call compile (ctrlText 316105)};"];
DEBUG_CMD6 ctrlAddEventHandler ["keydown","_key=_this select 1;if (_key == 28 || _key == 156) then {call compile (ctrlText 316106)};"];
The stuff in red is the new stuff. You may (I have already, but for other reasons) also have to add a dummy button to the dialog (one that doesn't do anything or show anything) that replaces CommandButton1's default parameter so that this isn't executed as well when you hit enter. Instead the dummy button gets the default flag, except when executed it's not actually doing something.
I tried forEach and "_key in _enterkeys" and whatnot to make it look better, but didn't work. Probably scope problems within the compiles.