Hello,
How do I solve the problem with ‘valuefield’.
I have a minimum value of 0.001 and a maximum of math.huge.
If I enter the wrong value (enter text), the field is corrected as expected.
I have a problem, I try to enter a smaller value. It throws an error.
std::logic_error: 'ViewBuilder: invalid value for valuefield: '0.000997732'. value must be [0.001 - inf].'
Do you use tostring and tonumber?
Rounding or restricting the return value might fix it. An random example:
tostring=function(value) return ("%.1f%%"):format(value) end,
tonumber=function(value) if (tonumber(value)) then return tonumber(value) end end,
notifier=function(value) if -- bla bla bla end end
tostring=function(val)
return ('%.04f s'):format(val)
end,
tonumber=function(str)
local val = tonumber(str)
return val
end,
notifier=function(value)
local val = int(value * self.samplerate)
if val < self.vbs.buffer.min then
val = self.vbs.buffer.min
end
self.vbs.buffer.value = val
if self.func then
self.func()
end
end
ehhh, i’m stupid. I’m roundind to %.04f but i have minimum value 0.001 !!!
Now works.