This is the code from Momentum custom study:
@Override
public void initialize(Defaults defaults) {
var sd = createSD();
var tab = sd.addTab(get("TAB_GENERAL"));
var inputs = tab.addGroup(get("LBL_INPUTS"));
inputs.addRow(new InputDescriptor(Inputs.INPUT, get("LBL_INPUT"), Enums.BarInput.CLOSE));
inputs.addRow(new IntegerDescriptor(Inputs.PERIOD, get("LBL_PERIOD"), 14, 1, 9999, 1));
var lines = tab.addGroup(get("LBL_COLORS"));
lines.addRow(new PathDescriptor(Inputs.PATH, get("LBL_LINE"), defaults.getLineColor(), 1.0f, null));
lines.addRow(new IndicatorDescriptor(Inputs.IND, get("LBL_INDICATOR"), null, null, false, true, true));
// Quick Settings (Tool Bar and Popup Editor)
sd.addQuickSettings(Inputs.INPUT);
sd.addQuickSettings(new SliderDescriptor(Inputs.PERIOD, get("LBL_PERIOD"), 14, 1, 9999, true, Enums.Icon.SINE_WAVE::get));
sd.addQuickSettings(Inputs.PATH);
var desc = createRD();
desc.setLabelSettings(Inputs.INPUT, Inputs.PERIOD);
desc.exportValue(new ValueDescriptor(Values.M, get("LBL_MOMENTUM"), new String[]{Inputs.INPUT, Inputs.PERIOD}));
desc.declarePath(Values.M, Inputs.PATH);
desc.declareIndicator(Values.M, Inputs.IND);
desc.setRangeKeys(Values.M);
}
This line add a drop-down list to the UI:
inputs.addRow(new InputDescriptor(Inputs.INPUT, get("LBL_INPUT"), Enums.BarInput.CLOSE));
How do I find which item is selected in the drop-down menu by the user from the code? I think I need to implement a custom event listener, but I'm not sure how to implement it.
@Override
public void initialize(Defaults defaults) {
var sd = createSD();
var tab = sd.addTab(get("TAB_GENERAL"));
var inputs = tab.addGroup(get("LBL_INPUTS"));
inputs.addRow(new InputDescriptor(Inputs.INPUT, get("LBL_INPUT"), Enums.BarInput.CLOSE));
inputs.addRow(new IntegerDescriptor(Inputs.PERIOD, get("LBL_PERIOD"), 14, 1, 9999, 1));
var lines = tab.addGroup(get("LBL_COLORS"));
lines.addRow(new PathDescriptor(Inputs.PATH, get("LBL_LINE"), defaults.getLineColor(), 1.0f, null));
lines.addRow(new IndicatorDescriptor(Inputs.IND, get("LBL_INDICATOR"), null, null, false, true, true));
// Quick Settings (Tool Bar and Popup Editor)
sd.addQuickSettings(Inputs.INPUT);
sd.addQuickSettings(new SliderDescriptor(Inputs.PERIOD, get("LBL_PERIOD"), 14, 1, 9999, true, Enums.Icon.SINE_WAVE::get));
sd.addQuickSettings(Inputs.PATH);
var desc = createRD();
desc.setLabelSettings(Inputs.INPUT, Inputs.PERIOD);
desc.exportValue(new ValueDescriptor(Values.M, get("LBL_MOMENTUM"), new String[]{Inputs.INPUT, Inputs.PERIOD}));
desc.declarePath(Values.M, Inputs.PATH);
desc.declareIndicator(Values.M, Inputs.IND);
desc.setRangeKeys(Values.M);
}
This line add a drop-down list to the UI:
inputs.addRow(new InputDescriptor(Inputs.INPUT, get("LBL_INPUT"), Enums.BarInput.CLOSE));
How do I find which item is selected in the drop-down menu by the user from the code? I think I need to implement a custom event listener, but I'm not sure how to implement it.