View Single Post
Old 10-22-2019, 07:28 PM   #545
babag
Human being with feelings
 
Join Date: Nov 2009
Posts: 1,704
Default

this seems to work:
Code:
local button_width      = 62
local button_height     = 32
local buttons_per_row   = 13
local row_buttons       = -1

for k, v in ipairs(toolbar_buttons) do
  if row_buttons == (buttons_per_row - 1) then
      row_buttons = 0
  else
      row_buttons = (row_buttons + 1)
  end
    GUI.New(
    "btn_"..k, 
    "Button", 
    1, 
    (row_buttons) * (button_width + 1), -- x
    math.floor((k - 1) / buttons_per_row) *  button_height, -- y
    button_width, -- w
    button_height, -- h
    v.label, 
    function() reaper.Main_OnCommand(v.command, 0) end
  )

end
inelegant, i'm sure but it seems to put things in the right place. i had a lot of trouble getting that to happen.

thanks,
babag
babag is offline   Reply With Quote