Actually, I figured this out after hours of experimenting with Mask Parameters. This is one way to do it: You can access the 'MaskStyles' parameter like so:-
myMaskStylesVar = get_param(gcb, 'MaskStyles');
Here you should be able to observe the MaskStyles for each of your parameters as edit, checkbox, DataTypeStr, Minimum, Maximum or ...wait for it... popup! Yes, and 'popup' style is defined as follows:-
popup(menuitem1|menuitem2|menuitem3|...
So you can modify the corresponding cell of myMaskStylesVar with the menu items of your choice and set them back as:-
myMaskStylesVar{1} = 'popup(red|green|blue|yellow)';
set_param(gcb, 'MaskStyles', myMaskStylesVar)
You can add this code at any desired callback. In my case, I put it in 'OpenFcn'. However that led to another issue with the Mask Parameters Dialog not being invoked at the end of the code. So I had to do some crude workaround like below to invoke the Mask Parameter Dialog, but at the same time, not lose my precious code above!
a = get_param(gcb, 'OpenFcn');
set_param(gcb, 'OpenFcn', '');
open_system(gcb);
set_param(gcb, 'OpenFcn', a);
I am 99.99% sure this issue can be handled in a less comical way than above. But it works for me and my boss doesn't complain!! :)
Best Answer