View Single Post
Old 11-12-2018, 10:06 PM   #343
dsyrock
Human being with feelings
 
dsyrock's Avatar
 
Join Date: Sep 2018
Location: China
Posts: 189
Default

Quote:
Originally Posted by Lokasenna View Post
Setting it to a function will show whatever is returned by calling my_function(value). For instance, to make the knob show "dB" next to every number you would use:
Code:
local function append_db(value)
  return value .. "dB"
end

GUI.elms.my_knob.output = append_db

OK, it seems that the knob can not run a function directly, it can only send some value out. So is the slider?

If I want a knob to adjust item's volume, I need to define a function that get the value from knob using GUI.Val("myknob"), then give it to item via SetMediaItemSelected, and then run the function in defer mode. I tried before and it worked. But I do not know if there any better way to code it. Please let me know, THANKS!


UPDATE: I just realized that I can use "onmousedown" and "onmousedrag" to do that, thats amazing! Thanks again!!

Last edited by dsyrock; 11-13-2018 at 09:44 AM.
dsyrock is offline   Reply With Quote