View Single Post
Old 10-22-2019, 08:06 PM   #546
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

And that's why I shouldn't write code in a text editor where I can't check if it's correct... :/ Sorry.

Quote:
Originally Posted by babag View Post
inelegant, i'm sure but it seems to put things in the right place. i had a lot of trouble getting that to happen.
You can use a similar idea to how it calculates y to get x. Try:
Code:
  GUI.New(
    "btn_"..k, 
    "Button", 
    1, 
    ((k - 1) % buttons_per_row) * button_width, -- 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
  )
__________________
I'm no longer using Reaper or working on scripts for it. Sorry. :(
Default 5.0 Nitpicky Edition / GUI library for Lua scripts / Theory Helper / Radial Menu / Donate
Lokasenna is offline   Reply With Quote