Is it possible to set specific button as selected button in modal window to allow usage of that button with enter/space press?
In the example script I have added I would like to have default selection to be "OK" button of modal window but by default it is set as first selection of radio box (in this case "Option 1") and I haven't figured out how to change it. I managed to do this by creating fake button as first element in the new window (selected by default) which clicks the Ok button but I feel this is a bit hacky way to get it working (commented out in the example script).
Names Default To Here(1);
okPushed = 0;
nw = New Window("Modal window", << modal, Show toolbars(0), Show menu(0),
//fakebutton = Button Box(" ",<< Style("underline"), << set function(ok_button << click)),
rb = Radio Box(
{"Option 1", "Option 2"}, << Set(2)
),
Panelbox("Actions",
Hlistbox(
ok_button = button box("OK", okPushed = 1; sel = rb << get selected),
cancel_button = button box("Cancel", okPushed = 0; stop();),
)
),
);
if(okPushed == 0, stop());
show(sel);
-Jarmo