From 615642dd88a8a4c615e176ae559ce86bbce60c26 Mon Sep 17 00:00:00 2001 From: ironcross32 Date: Thu, 24 Oct 2024 11:59:11 -0400 Subject: [PATCH] Adds two new methods of the audio_form class for querying the minimum and maximum values of a given slider. --- .../Methods/get_slider_maximum_value.md | 13 ++++++++ .../Methods/get_slider_minimum_value.md | 13 ++++++++ release/include/form.nvgt | 32 +++++++++++++++++++ 3 files changed, 58 insertions(+) create mode 100644 doc/src/references/include/Auditory User Interface (form.nvgt)/Classes/audio_form/Methods/get_slider_maximum_value.md create mode 100644 doc/src/references/include/Auditory User Interface (form.nvgt)/Classes/audio_form/Methods/get_slider_minimum_value.md diff --git a/doc/src/references/include/Auditory User Interface (form.nvgt)/Classes/audio_form/Methods/get_slider_maximum_value.md b/doc/src/references/include/Auditory User Interface (form.nvgt)/Classes/audio_form/Methods/get_slider_maximum_value.md new file mode 100644 index 00000000..df229d01 --- /dev/null +++ b/doc/src/references/include/Auditory User Interface (form.nvgt)/Classes/audio_form/Methods/get_slider_maximum_value.md @@ -0,0 +1,13 @@ +# get_slider_maximum_value +Get the maximum value of a slider. + +`double audio_form::get_slider_maximum_value(int control_index);` + +## Arguments: +* int control_index: the index of the slider to query. + +## Returns: +double: the maximum allowable value the slider may be set to. In case of error, this may return -1. To get error information, see `audio_form::get_last_error();`. + +## Remarks: +This method only works on slider control. diff --git a/doc/src/references/include/Auditory User Interface (form.nvgt)/Classes/audio_form/Methods/get_slider_minimum_value.md b/doc/src/references/include/Auditory User Interface (form.nvgt)/Classes/audio_form/Methods/get_slider_minimum_value.md new file mode 100644 index 00000000..cb6e68d7 --- /dev/null +++ b/doc/src/references/include/Auditory User Interface (form.nvgt)/Classes/audio_form/Methods/get_slider_minimum_value.md @@ -0,0 +1,13 @@ +# get_slider_minimum_value +Get the minimum value of a slider. + +`double audio_form::get_slider_minimum_value(int control_index);` + +## Arguments: +* int control_index: the index of the slider to query. + +## Returns: +double: the minimum allowable value the slider may be set to. In case of error, this may return -1. To get error information, see `audio_form::get_last_error();`. + +## Remarks: +This method only works on slider control. diff --git a/release/include/form.nvgt b/release/include/form.nvgt index 1927aa17..ed166b5a 100644 --- a/release/include/form.nvgt +++ b/release/include/form.nvgt @@ -1944,6 +1944,38 @@ class audio_form { } return c_form[control_index].slider_value; } + double get_slider_minimum_value(int control_index) { + form_error = 0; + if (!active) { + form_error = form_error_no_window; + return -1; + } + if ((control_index < 0) || (control_index > c_form.length() - 1)) { + form_error = form_error_invalid_index; + return -1; + } + if (c_form[control_index].type != ct_slider) { + form_error = form_error_invalid_control; + return -1; + } + return c_form[control_index].slider_minimum_value; +} +double get_slider_maximum_value(int control_index) { + form_error = 0; + if (!active) { + form_error = form_error_no_window; + return -1; + } + if ((control_index < 0) || (control_index > c_form.length() - 1)) { + form_error = form_error_invalid_index; + return -1; + } + if (c_form[control_index].type != ct_slider) { + form_error = form_error_invalid_control; + return -1; + } + return c_form[control_index].slider_maximum_value; +} string get_slider_text_value(int control_index, double value) { form_error = 0; if (!active) {