Skip to content

Commit

Permalink
Adds two new methods of the audio_form class for querying the minimum…
Browse files Browse the repository at this point in the history
… and maximum values of a given slider.
  • Loading branch information
ironcross32 authored and braillescreen committed Oct 24, 2024
1 parent bf7a704 commit 615642d
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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.
Original file line number Diff line number Diff line change
@@ -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.
32 changes: 32 additions & 0 deletions release/include/form.nvgt
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 615642d

Please sign in to comment.