View Single Post
Old 11-14-2018, 01:25 PM   #356
dsyrock
Human being with feelings
 
dsyrock's Avatar
 
Join Date: Sep 2018
Location: China
Posts: 94
Default

Quote:
Originally Posted by Lokasenna View Post
That's very strange, not sure why it would be happening - does your script have custom functions for those or anything?
Here is the simple version of my code

Code:
function functionB()

 some codes

end

function functionA()

  some codes

    GUI.New("mylider", "Slider", {     --recreate the slider
        z = 11,
        x = 1096.0,
        y = 5.0,
        w = 106,
        min=0,
        max=newvalue,                  -- new value of max
        defaults=0,    
        caption = "myslider",
        font = 3,
        col_txt = "txt",
        --col_fill = "elm_frame",
        show_values=false
       
    })    

    function GUI.elms.myslider:onmousedown()      --have to declare it again

     GUI.Slider.onmousedown(self)
   
      funntionB()
      
    end
    
    function GUI.elms.myslider:ondrag()           --have to declare it again

      GUI.Slider.ondrag(self)

      functionB()

    end

  reaper.defer(functionA)

end

----------------------
--                  --
--    Load Files    --
--                  --
---------------------- 
local lib_path = reaper.GetExtState("Lokasenna_GUI", "lib_path_v2")
if not lib_path or lib_path == "" then
    reaper.MB("Couldn't load the Lokasenna_GUI library. Please run 'Set Lokasenna_GUI v2 library path.lua' in the Lokasenna_GUI folder.", "Whoops!", 0)
    return
end
loadfile(lib_path .. "Core.lua")()

GUI.req("Classes/Class - Slider.lua")()

if missing_lib then return 0 end  


--------------------------------
--                            --
--         GUI Elements       --
--                            --
--------------------------------

GUI.name = "ToolBar"
GUI.x, GUI.y, GUI.w, GUI.h = 0, 0, 1920, 480
GUI.anchor, GUI.corner = "screen", "C"

GUI.New("myslider", "Slider", {
    z = 11,
    x = 1096.0,
    y = 5.0,
    w = 106,
    min=0,
    max=60,                  --just an initial value
    defaults=0,    
    caption = "myslider",
    font = 3,
    col_txt = "txt",
    --col_fill = "elm_frame",
    show_values=false,
        
})

    function GUI.elms.myslider:onmousedown()      --declare it for the first time

     GUI.Slider.onmousedown(self)
   
      funntionB()
      
    end
    
    function GUI.elms.myslider:ondrag()           --declare it for the first time

      GUI.Slider.ondrag(self)

      functionB()

    end 

GUI.Init()

GUI.Main()

functionB()
Is the anything I'm misunderstanding?
dsyrock is online now   Reply With Quote