Old 06-04-2016, 02:02 PM   #1
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default Lokasenna's GUI library for Lua v2

V3 update, February 2020 - v3 is now available on ReaPack! I'll make a separate thread for it when time allows, but in the meantime you can have a look at https://jalovatt.github.io/scythe

GUIs. We all need them, and they're a bit of a pain to make in ReaScript. Why not let someone else do the hard work so you can get back to actually making your script do something cool?



Installation:

ReaPack
- Install the Lokasenna's GUI library v2 for Lua package
- In Reaper's action list, run Set Lokasenna_GUI v2 library path.lua

Any scripts requiring this library should now be able to find it.

Manual
- Download the files here (including any subfolders), making sure to keep the same folder structure wherever you put them on your hard drive
- Find and run the install script, Set Lokasenna_GUI v2 library path.lua

Developers
A second package, Lokasenna's GUI library v2 for Lua (developer tools), provides example scripts, templates, and documentation.


Development:
All of my work is done at Lokasenna_GUI on Github. Everything there is to be considered unstable, and probably not suitable for release, but any new feature updates or class additions will show up there. Contributions, bug reports, etc are all welcome.

Enjoy!


Reasons why you should use this sexy beast include:

- It comes with a GUI builder! (Experimental, see the Developer Tools package)


- Very little coding required on your part. A simple GUI might need only a dozen lines of code compared to the hundreds (or thousands, for some of my scripts) you'd have to write if you did it yourself.

- Global font and color settings, so you can change the overall look to suit your fancy.

- Layer visibility management, so you can have multiple sets of controls or dialog boxes come and go as needed.

- Graphics use blitting whenever possible, keeping the CPU usage low without any worry on your part.

- Hooks to run your own functions as part of the GUI's updating loop. You could relabel the options around a knob if you wanted, or have a slider and knob match the selected track's volume/pan... etc.

- Built-in crash reporting, providing more detailed error messages than Reaper does by itself.

- Can be told to exit from your own code, and to run a function when it does. For instance, "save all the current settings, run this action, and quit".

- Numerous helper functions in addition to the GUI code, simplifying a number of things that might be annoying to code on your own every time.

- Modular design, allowing you to use as much, or as little, of my own code as you want. You can also write your own classes if you'd prefer.


Changelog:

July 8/18: The "Lokasenna GUI v2.x.x" watermark now reads its version from ReaPack so I don't have to remember to update it.

June 27/18: First stable release, available on ReaPack. It will only be updated directly with bug fixes - any feature updates and new classes will live on the project repository until I feel like they're safe to move over.

June 6/18: Added support for creating elements with keyed tables rather than a series of function arguments, and an example script demonstrating it.

June 2/18: New class - Window. A number of under-the-hood improvements and new Core functions. Better crash reporting, and handling of Reaper's "restricted permissions" mode.

May 10/18: Fixed some weirdness with how Knob and Slider return their values. This update changes the parameters for both classes and will break any scripts that use them. My apologies.

April 29/18: Added Menubar class.

April 25/18: Added a basic crash reporter, moved the project to my own repository on Github.

April 22/18: Went through all of the classes/scripts and did some major tidying, as well as breaking most of the longer functions into smaller chunks.

April 8/18: Added Listbox and TextEditor classes. There were also a number of bug fixes and efficiency improvements back in... February? I forget.

September 26/17: Bug fix - the Knob class was ignoring min/max values when drawing values around the knob.

August 19/17: Bug fixes related to macOS using decimal values for the mousewheel, and scrolling the mousewheel on a Menubox with no options in it.

July 31/17: A few bug fixes.

June 9/17: First proper release. Classes are modular, tons of new features, code is much more efficient.

June 13/16: Rewrote the library to be copy/paste-able rather than distributing the file separately.
__________________
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

Last edited by Lokasenna; 02-09-2020 at 03:25 PM.
Lokasenna is offline   Reply With Quote
Old 06-04-2016, 06:13 PM   #2
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,866
Default

Thanks for your hard work on this, I'm sure it could be useful to a lot of scripters !!

Cheers !
X-Raym is offline   Reply With Quote
Old 06-04-2016, 10:19 PM   #3
michaeltonight
Human being with feelings
 
michaeltonight's Avatar
 
Join Date: Jun 2010
Location: Texas
Posts: 357
Default

This is amazing, Lokasenna.
michaeltonight is offline   Reply With Quote
Old 06-08-2016, 08:30 AM   #4
Ozman
Human being with feelings
 
Join Date: Feb 2015
Posts: 752
Default

This looks awesome!
Ozman is offline   Reply With Quote
Old 06-08-2016, 12:56 PM   #5
sfzgeek
Human being with feelings
 
sfzgeek's Avatar
 
Join Date: Feb 2009
Location: Dunedin, New Zealand
Posts: 205
Default

Bravo! Amazing work and excellent reference scripts!
__________________
My rawk band: The Hidden Venture.
sfzgeek is offline   Reply With Quote
Old 06-10-2016, 04:40 AM   #6
Brado231
Human being with feelings
 
Join Date: Sep 2012
Location: Oz
Posts: 196
Default

Great stuff! Thanks!!
Brado231 is offline   Reply With Quote
Old 06-11-2016, 05:16 AM   #7
raiirock
Human being with feelings
 
raiirock's Avatar
 
Join Date: Mar 2013
Location: Moscow
Posts: 99
Default

Looks great !
raiirock is offline   Reply With Quote
Old 06-13-2016, 08:49 PM   #8
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

Update to beta 2.

No feature changes, but I rewrote a couple of things so the library can now be copy/pasted into your script rather than distributing the file separately. See the comments at the beginning of the file for instructions.
__________________
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
Old 06-14-2016, 06:21 PM   #9
Spacemen Tree
Human being with feelings
 
Spacemen Tree's Avatar
 
Join Date: Mar 2013
Posts: 515
Default

Just the licecap in the OP screams AWESOME!!!

Great stuff. Kudos!
__________________
"After silence, that which comes nearest to expressing the inexpressible is music", Aldous Huxley
Spacemen Tree is offline   Reply With Quote
Old 06-15-2016, 11:14 AM   #10
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

I haven't tested this yet, but it's looking very good Thanks Lokasenna!
spk77 is offline   Reply With Quote
Old 06-15-2016, 11:24 AM   #11
tack
Human being with feelings
 
tack's Avatar
 
Join Date: Jan 2014
Location: Ontario, Canada
Posts: 1,618
Default

It's not possible to write JSFX plugins in Lua is it? I'd love to be able use this for FX as well, but I fear it's Eel or bust.
tack is offline   Reply With Quote
Old 06-09-2017, 12:08 PM   #12
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

Updated to version 1.0.

Lots of new features, new classes, bug fixes, efficiency improvements, 33% less sodium with the same great taste.
__________________
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
Old 06-28-2017, 07:40 AM   #13
deeb
Human being with feelings
 
deeb's Avatar
 
Join Date: Feb 2017
Posts: 4,812
Default

Quote:
Originally Posted by Lokasenna View Post
Updated to version 1.0.

Lots of new features, new classes, bug fixes, efficiency improvements, 33% less sodium with the same great taste.
very nice ! thanks a lot! will check this today
deeb is offline   Reply With Quote
Old 06-29-2017, 06:18 AM   #14
deeb
Human being with feelings
 
deeb's Avatar
 
Join Date: Feb 2017
Posts: 4,812
Default

hello Lokasenna! could you provide some example how to call a simple checkbox like the one you have in the original post, with "are you a cool guy?" , .. i tried yesterday but with no success.

Also, in the github examples, you are calling example: req("Classes//Class - Slider.lua") which in OSX gives an error and we have to change to: req("Classes\Class - Slider.lua"), so probably this could be sorted with a separator variable depending on the system.
Thank you
deeb is offline   Reply With Quote
Old 06-29-2017, 07:34 AM   #15
deeb
Human being with feelings
 
deeb's Avatar
 
Join Date: Feb 2017
Posts: 4,812
Default

also! you could a provide a way to , without changing the knob class, to not show the 100 in the image:

the knob is like this:
GUI.New("my_knob", "Knob", 1, 230, 32, 80, "Attack", 0, 100, 101, 0,0)

you say in comments:
vals Boolean. Display value labels?
For knobs with a lot of steps, i.e. Pan from -100 to +100, set this
to false and use a label to read the value, update the Knob's caption

I have seted it to false, but marks still showing and the 100 is just the last mark.
Is there an example too?

Cheers!
Attached Images
File Type: png Screen Shot 2017-06-29 at 15.29.55.png (11.5 KB, 15362 views)
deeb is offline   Reply With Quote
Old 07-01-2017, 02:16 AM   #16
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

1. A single-item checkbox just requires making one with no overall caption, and only one option in the list. There's also an option I seem to have missed when I was documenting everything, .frame, that lets you disable the border around the list:
Code:
GUI.New("my_chk", "Checklist", 1, 16, 16, 200, 32, "", "Are you a cool guy?")

GUI.elms.my_chk.frame = false
2. Good catch. As it happens, you can use GUI.file_sep here:
Code:
local sep = GUI.file_sep
req("Classes"..sep.."Class - Slider.lua")
If I get a chance I'll update the examples with that.

3. Working fine here:
Code:
GUI.New("my_knob", "Knob", 1, 230, 32, 80, "Attack", 0, 100, 101, 0,0)

GUI.elms.my_knob.vals = false
__________________
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
Old 07-01-2017, 03:10 AM   #17
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

Small update.

- Added the file separator check described above to all of the example files.

- Added a missing parameter to the Checklist documentation. .frame is a Boolean, defaults to True, and tells it whether or not to draw a frame around the list.
__________________
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
Old 07-20-2017, 05:28 PM   #18
deeb
Human being with feelings
 
deeb's Avatar
 
Join Date: Feb 2017
Posts: 4,812
Default

nice Lokasenna ! meanwhile i noticed that when adding values of 10 ~ or more for padding , the checkbox and also the radio has strange behaviour you click on D , C gets some times checked, Click on C checks D same times, and so on Can you check if you get the same?




In example:
GUI.New("chklist", "Checklist",1, 30 ,20 , 100, 150, "","A,B,C,D","v", 20 )
Attached Images
File Type: png Screen Shot 2017-07-21 at 01.24.08.png (8.6 KB, 15273 views)

Last edited by deeb; 07-20-2017 at 05:50 PM.
deeb is offline   Reply With Quote
Old 07-21-2017, 06:37 AM   #19
Flaneurette
Human being with feelings
 
Join Date: Dec 2016
Posts: 373
Default

Pretty cool. I am going to utilize this.

If there a way to include this lib, like a lib/include? or does it need to be in the same file as the other lua code? (still learning LUA)
Flaneurette is offline   Reply With Quote
Old 07-21-2017, 07:14 AM   #20
deeb
Human being with feelings
 
deeb's Avatar
 
Join Date: Feb 2017
Posts: 4,812
Default

Quote:
Originally Posted by Flaneurette View Post
Pretty cool. I am going to utilize this.

If there a way to include this lib, like a lib/include? or does it need to be in the same file as the other lua code? (still learning LUA)
in the GUI examples lokasenna did for us, he uses a custom function called "req". Probably you could check it.
deeb is offline   Reply With Quote
Old 07-21-2017, 08:48 AM   #21
Flaneurette
Human being with feelings
 
Join Date: Dec 2016
Posts: 373
Default

Quote:
Originally Posted by deeb View Post
in the GUI examples lokasenna did for us, he uses a custom function called "req". Probably you could check it.

Got it! the Example - General demonstration.lua explains it.
Flaneurette is offline   Reply With Quote
Old 07-21-2017, 10:05 AM   #22
Flaneurette
Human being with feelings
 
Join Date: Dec 2016
Posts: 373
Default

Lokasenna,

Is it possible to dump an (multidimensional) array/table inside a menu? would be cool. As I can see, it's only string right now.

Like:

Code:
GUI.New("my_mnu", "Menubox", 3, 256, 176, 64, 20, "Options:", MyArray)
Code:
MyArray = {
    {'FOO', 5},
    {'BAR', 2}
...etc 
}
Flaneurette is offline   Reply With Quote
Old 07-22-2017, 06:44 AM   #23
Flaneurette
Human being with feelings
 
Join Date: Dec 2016
Posts: 373
Default

Another thing that might be interesting. When filling a menubox with many items, it overflows:




But it does something strange too, it seems to repeat certain values at the bottom and grey them out:

Flaneurette is offline   Reply With Quote
Old 07-22-2017, 02:16 PM   #24
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

Quote:
Originally Posted by deeb View Post
nice Lokasenna ! meanwhile i noticed that when adding values of 10 ~ or more for padding , the checkbox and also the radio has strange behaviour you click on D , C gets some times checked, Click on C checks D same times, and so on Can you check if you get the same?




In example:
GUI.New("chklist", "Checklist",1, 30 ,20 , 100, 150, "","A,B,C,D","v", 20 )
I think the issue is that my check for "what option is the mouse over?" doesn't correct for padding at the top/bottom. Or something like that.

Will have a look.
__________________
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
Old 07-22-2017, 02:22 PM   #25
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

Quote:
Originally Posted by Flaneurette View Post
Lokasenna,

Is it possible to dump an (multidimensional) array/table inside a menu? would be cool. As I can see, it's only string right now.
It would much easier to do on your end than to build it into the GUI class, since I can't know what dimensions and indexing are being used for a user's table.

For the table listed above, you could do something like this (code might not be 100% correct, can't check it right now):

Code:
local function GetMenuItems()

  local str = ""

  for i = 1, #MyArray - 1 do
    str = str..MyArray[i][1]..","
  end

  -- This avoids an extra , at the end of the string
  str = str..MyArray[#MyArray][1]

  return str
end

...

GUI.New("my_mnu", "Menubox", 3, 256, 176, 64, 20, "Options:", GetMenuItems())
__________________
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
Old 07-22-2017, 02:27 PM   #26
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

Quote:
Originally Posted by Flaneurette View Post
Another thing that might be interesting. When filling a menubox with many items, it overflows
There's no way (AFAIK) to restrict the menu's length or tell it to wrap to a second column - the menu itself is a function provided by Reaper. You should get little up/down arrows when it leaves the screen though.

Quote:
But it does something strange too, it seems to repeat certain values at the bottom and grey them out
Reaper's gfx.showmenu function uses specific prefixes for folders, graying out, etc, so that should only happen if a menu item starts with "#". See: https://www.extremraym.com/cloud/rea...a_gfx.showmenu

How are you generating the list? The Menubox class doesn't (well, shouldn't be) do anything with the list you give it aside from changing the commas to |s.
__________________
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
Old 07-23-2017, 06:20 AM   #27
deeb
Human being with feelings
 
deeb's Avatar
 
Join Date: Feb 2017
Posts: 4,812
Default

Quote:
Originally Posted by Lokasenna View Post
I think the issue is that my check for "what option is the mouse over?" doesn't correct for padding at the top/bottom. Or something like that.

Will have a look.
Yep seems something like that: Mouse Over is not being affected by The padding. Thank you lokasenna
deeb is offline   Reply With Quote
Old 07-23-2017, 06:41 AM   #28
Flaneurette
Human being with feelings
 
Join Date: Dec 2016
Posts: 373
Default

Quote:
Originally Posted by Lokasenna View Post
Reaper's gfx.showmenu function uses specific prefixes for folders, graying out, etc, so that should only happen if a menu item starts with "#". See: https://www.extremraym.com/cloud/rea...a_gfx.showmenu
Hah! Yes, I use # for sharps... that's hilarious. As if sharps aren't used in music... what was he thinking! lol.

So... how were going to use sharps? will it take unicode? escaping it with another sharp doesn't work...
Flaneurette is offline   Reply With Quote
Old 07-23-2017, 06:56 AM   #29
Flaneurette
Human being with feelings
 
Join Date: Dec 2016
Posts: 373
Default

Using the UTF-8 glyph seems to work: ♯

Or, a somewhat cleaner method:

Code:
utf8.char(9839)
Flaneurette is offline   Reply With Quote
Old 07-23-2017, 09:35 AM   #30
Flaneurette
Human being with feelings
 
Join Date: Dec 2016
Posts: 373
Default

Also made a custom adjustment/preference in the Menubox.lua.

Code:
290	local x, y = self.x, self.y
291	gfx.x, gfx.y = self.x, self.y + 20
or
Code:
290	self.__index = self
291	gfx.x, gfx.y = self.x, self.y + 20
instead of:

Code:
290	gfx.x, gfx.y = GUI.mouse.x, GUI.mouse.y
This way the dropdown will fit tightly next, and under the menubox instead of floating around wherever I click.
Flaneurette is offline   Reply With Quote
Old 07-23-2017, 03:10 PM   #31
deeb
Human being with feelings
 
deeb's Avatar
 
Join Date: Feb 2017
Posts: 4,812
Default

Would like to make a request, probably would be nice if elements like:

Menubox,
Checklist,
Radio,
even knobs

accept a function as argument like button does for onclick, but in this case for onselect, so that some actions could be maded based on this information immediatlly.


Thanks!!
deeb is offline   Reply With Quote
Old 07-24-2017, 07:02 PM   #32
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

You can do that easily yourself by rewriting the appropriate method for whichever element you want. i.e:

Code:
--Load all the classes

GUI.New("mnu_mymenu", "Menubox", ...whatever the Menubox params are...)

function GUI.elms.mnu_mymenu:onmouseup()

  -- Run the existing code for the menu
  -- This could be after your extra code instead if you want
  GUI.Menubox.onmouseup(self)

  DoMyStuff(self.retval)

end
Or, if you need to do that with multiple elements, you can easily create a new class based on Menubox and rewrite the method for that:

Code:
-- Load all your libraries

GUI.MyMenuBox = GUI.Menubox

function GUI.MyMenuBox:onmouseup()

  -- As above

end
See the example scripts for an, er, example of this in action. The code/formatting above might not be correct.
__________________
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
Old 07-27-2017, 10:06 AM   #33
deeb
Human being with feelings
 
deeb's Avatar
 
Join Date: Feb 2017
Posts: 4,812
Default

Quote:
Originally Posted by Lokasenna View Post
You can do that easily yourself by rewriting the appropriate method for whichever element you want. i.e:

Code:
--Load all the classes

GUI.New("mnu_mymenu", "Menubox", ...whatever the Menubox params are...)

function GUI.elms.mnu_mymenu:onmouseup()

  -- Run the existing code for the menu
  -- This could be after your extra code instead if you want
  GUI.Menubox.onmouseup(self)

  DoMyStuff(self.retval)

end
Or, if you need to do that with multiple elements, you can easily create a new class based on Menubox and rewrite the method for that:

Code:
-- Load all your libraries

GUI.MyMenuBox = GUI.Menubox

function GUI.MyMenuBox:onmouseup()

  -- As above

end
See the example scripts for an, er, example of this in action. The code/formatting above might not be correct.

Back to this! awesome
deeb is offline   Reply With Quote
Old 07-27-2017, 11:08 AM   #34
deeb
Human being with feelings
 
deeb's Avatar
 
Join Date: Feb 2017
Posts: 4,812
Default

Imagine this:
GUI.New("menu" ,"Menubox", 1, 1, 1, 250, 30, "", "A,B" )

How can i make this menu be defaulted to B when loading without changing the "A,B" string?

Thanks man!
deeb is offline   Reply With Quote
Old 07-28-2017, 02:42 PM   #35
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

GUI.Val can be used for both reading and setting elements' values:

Code:
GUI.New("menu" ,"Menubox",	1, 1,	1, 250, 30, "", "A,B" )
GUI.Val("menu", 2)
__________________
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
Old 07-29-2017, 08:34 AM   #36
deeb
Human being with feelings
 
deeb's Avatar
 
Join Date: Feb 2017
Posts: 4,812
Default

Quote:
Originally Posted by deeb View Post
nice Lokasenna ! meanwhile i noticed that when adding values of 10 ~ or more for padding , the checkbox and also the radio has strange behaviour you click on D , C gets some times checked, Click on C checks D same times, and so on Can you check if you get the same?




In example:
GUI.New("chklist", "Checklist",1, 30 ,20 , 100, 150, "","A,B,C,D","v", 20 )
This is Whats is buggin me now . I'll try and see if i can fix ir later
deeb is offline   Reply With Quote
Old 07-29-2017, 08:36 AM   #37
deeb
Human being with feelings
 
deeb's Avatar
 
Join Date: Feb 2017
Posts: 4,812
Default

Is it possible without changing tab classe Tô have tabs with multiple rows?
deeb is offline   Reply With Quote
Old 07-29-2017, 02:53 PM   #38
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

Quote:
Originally Posted by deeb View Post
This is Whats is buggin me now . I'll try and see if i can fix ir later
That would be awesome; I'm a couple of weeks away from having any time to fiddle with it myself.

Both of them use the same logic - Checklist in nmouseup and Radio in nmousedown:
Code:
	-- See which option it's on
	local mouseopt = self.dir == "h" 	and (GUI.mouse.x - (self.x + 0.5*self.chk_w))
										or	(GUI.mouse.y - (self.y + self.cap_h + self.pad) )
	mouseopt = mouseopt / ((self.chk_w + self.pad) * #self.optarray)
	mouseopt = GUI.clamp( math.floor(mouseopt * #self.optarray) + 1 , 1, #self.optarray )
Edit: I can't actually reproduce it on my end. If the checklist's height is too small then the last couple of options spill outside the frame and aren't clickable, but it appears to be properly detecting the option I'm over.

Quote:
Originally Posted by deeb View Post
Is it possible without changing tab classe Tô have tabs with multiple rows?
Not at the moment.
__________________
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

Last edited by Lokasenna; 07-29-2017 at 03:07 PM.
Lokasenna is offline   Reply With Quote
Old 07-29-2017, 03:03 PM   #39
deeb
Human being with feelings
 
deeb's Avatar
 
Join Date: Feb 2017
Posts: 4,812
Default

ok! thanks ! all good meanwhile
deeb is offline   Reply With Quote
Old 07-29-2017, 05:21 PM   #40
deeb
Human being with feelings
 
deeb's Avatar
 
Join Date: Feb 2017
Posts: 4,812
Default

Quote:
Originally Posted by Lokasenna View Post
You can do that easily yourself by rewriting the appropriate method for whichever element you want. i.e:

Code:
--Load all the classes

GUI.New("mnu_mymenu", "Menubox", ...whatever the Menubox params are...)

function GUI.elms.mnu_mymenu:onmouseup()

  -- Run the existing code for the menu
  -- This could be after your extra code instead if you want
  GUI.Menubox.onmouseup(self)






  DoMyStuff(self.retval)

end
Or, if you need to do that with multiple elements, you can easily create a new class based on Menubox and rewrite the method for that:

Code:
-- Load all your libraries

GUI.MyMenuBox = GUI.Menubox

function GUI.MyMenuBox:onmouseup()

  -- As above

end
See the example scripts for an, er, example of this in action. The code/formatting above might not be correct.

Thanks for your last edit, i will go to that part next
some days ago i had to use this:
Code:
function GUI.elms.menu1:onmouseup()
(...)
   GUI.Menubox.onmouseup(self)
end
and it worked.


but now i had the need to use this, to make the onmouse work for many elements:
Code:
function GUI.MyMenuBox:onmouseup()
    GUI.Menubox.onmouseup(self)
end
and i have an error: "stack overflow" on the console. I still didnt find how to solve! would be nice!


Edit: meanwhile i changed function GUI.Checklistnmouseup()and seems better now
Code:
local mouseopt = self.dir == "h" 	and (GUI.mouse.x - (self.x + 0.5*self.chk_w))
	 or	(GUI.mouse.y - (self.y + self.cap_h  ))
altho i don't like much that between checkboxes that space is always "clickable". . In this case for the checkbox before.But it is what it is ! it's great anyway.thank you

Last edited by deeb; 07-29-2017 at 08:13 PM.
deeb is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 08:18 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.