What's new

Quick question about adjusting ui_table range

midi_controller

Senior Member
Hey, probably a really basic question but I'm just trying to figure out how to set the output of the ui_table to go from something like 1-127 instead of 0-127. Digging through the manual didn't seem to give me any answers besides being able to adjust the top of the range instead of the bottom. Any help here would be much appreciated!

Thanks!
 
Just add 1 to the output value so you get 1-128 instead of 0-127.

Here's an example which should help:

on init``
``declare $i
``declare const $length_x := 127
``declare const $height_y := 127
``
``declare ui_value_edit $increment_X (0,20,1)
``set_text($increment_X,"Increment X")
``move_control ($increment_X, 6,1)
``
````declare ui_value_edit $increment_Y (0,20,1)
``set_text($increment_Y,"Increment Y")
``move_control ($increment_Y, 6,3)
``
``declare ui_label $x_label(1, 1)
``set_text($x_label,"X Value = ")
``move_control ($x_label, 6,2)
``
``declare ui_label $y_label(1, 1)
``set_text($y_label,"Y Value = ")
``move_control ($y_label, 6,4)

``declare ui_table %main_table[$length_x] (5, 4, $height_y)
``declare ui_table %backup_table[$length_x] (5, 4, $height_y)
``move_control (%backup_table, 0,0)
end on

on ui_control (%main_table)
``$i :=0
``while ($i < $length_x)
````if (%main_table[$i] # %backup_table[$i] )
``````set_text($x_label,"X Value = " & $i + $increment_X)
``````set_text($y_label,"Y Value = " & %main_table[$i] + $increment_Y)
````end if
````%backup_table[$i] := %main_table[$i]
````inc($i)
``end while
end on

Justin
 

Attachments

  • Table Example.png
    Table Example.png
    2.3 KB · Views: 23
Top Bottom