Old 04-15-2019, 06:18 AM   #441
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

V3 is almost ready for me to make the repo public and ask for help implementing all of the new features.

By all means, make your components in V2. V3 will break them, but it'll be a separate install and porting things over when it is released shouldn't be too rough.
__________________
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 04-15-2019, 11:25 AM   #442
woodslanding
Human being with feelings
 
woodslanding's Avatar
 
Join Date: Mar 2007
Location: Denver, CO
Posts: 633
Default

will v3 have image support? Because if it does, I probably won't have to create any components....

And I'll be able to give it some thorough testing.
__________________
eric moon
Very Stable Genius
https://gogolab.com/
woodslanding is offline   Reply With Quote
Old 04-15-2019, 01:14 PM   #443
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

That's one of the bigger (and probably easier ) items on the list, yeah.

At minimum, there will be a separate Image element class. Ideally the existing elements would be able to use images instead of their original drawing methods, but that will take a bit more work.
__________________
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 04-15-2019, 01:25 PM   #444
woodslanding
Human being with feelings
 
woodslanding's Avatar
 
Join Date: Mar 2007
Location: Denver, CO
Posts: 633
Default

Quote:
Originally Posted by Lokasenna View Post
That's one of the bigger (and probably easier ) items on the list, yeah.

At minimum, there will be a separate Image element class. Ideally the existing elements would be able to use images instead of their original drawing methods, but that will take a bit more work.
Well, yes. I think just displaying plain images is even within MY skill set Although a good mechanism for giving images globally unique identifiers stopped me from the beginning...
__________________
eric moon
Very Stable Genius
https://gogolab.com/
woodslanding is offline   Reply With Quote
Old 04-15-2019, 01:42 PM   #445
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

Unique identifiers in what sense? The Reaper API can generate GUIDs for you if that's what you're after.

If you look at how the GUI currently handles buffers, with elements requesting them from one central store, I'm planning to handle images the similarly.

- Script specifies a bunch of files to load and keys to refer to them with, such as knob = "knob.png". This could even just be "here's a folder" with the keys being taken from the filenames.

- They're loaded and assigned to buffers by the image handler.

- Elements can then blit images directly from the image handler with something like Image.blit("knob", scale, rotation, ...).

- For sprites, the size could be specified when loading the file and then the above could be extended to Image.blit("knob_sprite", frameNumber, scale, rotation, ...).

With that in place, some of the elements would be able to have their draw methods swapped directly for an image version. Others, like the Slider, would need a bit of a rewrite because they do a lot of work in their new and init methods. I'm trying to clean that up anyway though.

At some point I'd like the elements' control and logic code to be completely separate from their drawing code, so that re-theming is just a matter of giving your button a different drawing method when you create it.
__________________
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 04-15-2019, 04:15 PM   #446
kartalex
Human being with feelings
 
Join Date: Dec 2015
Posts: 172
Default

Hi, Lokasenna! Hi, guys)

I have a question.. My script needs to play a note, when a Frame on GUI is clicked.
I override onmousedown() function of GUI.elms.myFrame to send a "note on", and onmouseup() to send a "note off". This works. But if I click mouse faster - it doesn't because ondoubleclick() is called. Ok.. I override it like this:
Code:
function myFrame_ondoubleclick(self)
  myFrame_onmousedown(self)
end
now it sends "note on", but after double click it doesn't call onmouseup(), so note hangs until I click it again..

Question: how do I make it call onmouseup() after double clicks, or how to disable ondoubleclick() at all (make it call onmousedown() and onmouseup() every time, even when it's double-clicked)??

Thanks!
kartalex is online now   Reply With Quote
Old 04-15-2019, 07:22 PM   #447
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

The problem is that, when it detects a doubleclick, it also sets a couple of internal variables so that it doesn't call onmouseup at the same time. There's no way to disable that without modifying the GUI code directly.

Try calling onmouseup in your replacement doubleclick function instead of down.
__________________
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 04-15-2019, 08:00 PM   #448
woodslanding
Human being with feelings
 
woodslanding's Avatar
 
Join Date: Mar 2007
Location: Denver, CO
Posts: 633
Default

Well, a knob that doesn't need to be square, and can respond to either a vertical or horizontal drag can function just fine as a fader, as far as I'm concerned. I like how reaper uses the diagonal so either works on a knob.

Your multi-thumbed fader OTH is a different animal

I've never encountered a case where I wished I had more than 2 thumbs.... if you are doing velocity scaling or something, it's better to have a 2-d graph, I think.

2 thumbs is nice for a keyboard range fader, tho.

cheers,
-e
__________________
eric moon
Very Stable Genius
https://gogolab.com/
woodslanding is offline   Reply With Quote
Old 04-26-2019, 06:42 AM   #449
tXShooter
Human being with feelings
 
tXShooter's Avatar
 
Join Date: Aug 2017
Posts: 336
Default Scrollbars in Docked View

Lokasenna,
How do I get scrollbars in my GUI?

tXShooter
__________________
"But be ye doers of the word, and not hearers only, deceiving your own selves."
tXShooter is offline   Reply With Quote
Old 04-26-2019, 08:16 AM   #450
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

You don't.

The TextEditor and Listbox elements have them built in, but there isn't a standalone Scrollbar element or anything like that.

I played around with the idea a while back and got stuck, but I'm hoping to revisit it for v3.

For docked views, yeah, that's a shortcoming of the GUI at the moment. You can check the docked/not-docked state yourself and reposition your elements when it changes.
__________________
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 04-26-2019, 11:46 AM   #451
tXShooter
Human being with feelings
 
tXShooter's Avatar
 
Join Date: Aug 2017
Posts: 336
Default How do Tabs work?

In lieu of scrollbars, I thought maybe for now I could just use Tabs, which I see that you have provided elements for... thank you.

But.... how do they work?

Do I assign my elements a specific Z-Layer value and when a tab is selected, it will make that layer visible while hiding the others? How does the relationship work if this is the case? (Tab1=Z1, Tab2=Z2) ??

I tried to find any code (or post for that matter) that might illustrate this, but I think that the search term 'tabs' is too generic, especially on a forum that might be heavily involved with guitar tabs.
__________________
"But be ye doers of the word, and not hearers only, deceiving your own selves."
tXShooter is offline   Reply With Quote
Old 04-26-2019, 12:55 PM   #452
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

You assign each tab a set of z-layers that it will manage, hiding and unhiding them for you. Layers can be active for more than one tab, and any layers that aren't assigned to a tab at all will always be visible (i.e. the layer that the tab element is on).

The General Demonstration example uses them, and it should have enough explanation in the comments to get you started.

Also: https://github.com/jalovatt/Lokasenn...wiki/2.00-Tabs
__________________
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 04-26-2019, 01:22 PM   #453
tXShooter
Human being with feelings
 
tXShooter's Avatar
 
Join Date: Aug 2017
Posts: 336
Default

Quote:
Originally Posted by Lokasenna View Post
Thank you.

I had visited your link before, but there wasn't any code that showed its use in a script, so I came here asking for more info. I'm the kind of person that needs to see an example before I 'get it'. I couldn't see where you assign tabs a set of z-layers that it will manage.

I'll toy around with the information you just gave me and see where that leads.

Thanks again.
__________________
"But be ye doers of the word, and not hearers only, deceiving your own selves."
tXShooter is offline   Reply With Quote
Old 04-26-2019, 01:25 PM   #454
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

No worries.

Here's the line in that particular example:
https://github.com/ReaTeam/ReaScript...ation.lua#L164

The table's indices correspond to the tab numbers (left to right), and then each of those gets a table of z numbers.
__________________
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 04-26-2019, 02:04 PM   #455
tXShooter
Human being with feelings
 
tXShooter's Avatar
 
Join Date: Aug 2017
Posts: 336
Default

Quote:
Originally Posted by Lokasenna View Post
No worries.

Here's the line in that particular example:
https://github.com/ReaTeam/ReaScript...ation.lua#L164

The table's indices correspond to the tab numbers (left to right), and then each of those gets a table of z numbers.
Quote:
-- Notice that layers 1 and 2 aren't assigned to a tab; this leaves them visible
-- all the time.
That's a handy piece of information to have. Thank you.

Also, how are tab_idx affected from one tab page to the next? Do they start over on each tab, or do they have to be contiguous all the way through the GUI?
__________________
"But be ye doers of the word, and not hearers only, deceiving your own selves."
tXShooter is offline   Reply With Quote
Old 04-26-2019, 02:13 PM   #456
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

tab_idx only applies to Textbox elements, and is global - i.e. it will happily try to tab to an element on a hidden tab.

The tab-to-focus functionality is pretty rough and I probably shouldn't have even included it.
__________________
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 04-26-2019, 02:52 PM   #457
tXShooter
Human being with feelings
 
tXShooter's Avatar
 
Join Date: Aug 2017
Posts: 336
Default

Quote:
Originally Posted by Lokasenna View Post
tab_idx only applies to Textbox elements, and is global - i.e. it will happily try to tab to an element on a hidden tab.

The tab-to-focus functionality is pretty rough and I probably shouldn't have even included it.
That's something that I think I can work with / around for the time being. I'm glad that you did include it... makes some things easier.

One more question, and this goes back to the rudimentary design of your GUI interface. I am going to have nearly 400 elements in a grid-like arrangement across 4 tabs, but I'm having to code for each element by hand. Is it possible to equate a variable to a constant and plug that into the X, Y, and Z positions for each each element? It would make adjusting groups a lot easier if it's allowed.

i.e. Tab1Line1Y = 45 (in the variable definitions)

GUI.New("TextBox1", "Textbox", {
y = Tab1Line1Y,
__________________
"But be ye doers of the word, and not hearers only, deceiving your own selves."
tXShooter is offline   Reply With Quote
Old 04-26-2019, 03:00 PM   #458
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

Absolutely, just like that. I've done the following in a few scripts just to let me group different sections together so I can move them as a group:

Code:
local button_ref = {
  x = 0,
  y = 0,
  w = 64,
  h = 22,
  spacing = 4,
}

GUI.New("btn1", "Button", 1, button_ref.x, button_ref.y, button_ref.w, button_ref.h, ...
GUI.New("btn2", "Button", 1, button_ref.x + button_ref.w + button_ref.spacing, button_ref.y, button_ref.w, button_ref.h, ...
Radial Menu uses a bunch of them to manage the different "panels".

I don't have it handy on this machine, but for a script I'm working on right now I extended that idea to use functions for the X and Y coordinates so you don't have to manually add the padding or use a multiplier for each one.

Bottom line: The GUI doesn't care as long as it gets a number somehow.
__________________
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 04-27-2019, 10:12 AM   #459
tXShooter
Human being with feelings
 
tXShooter's Avatar
 
Join Date: Aug 2017
Posts: 336
Default

Quote:
Originally Posted by Lokasenna View Post
Absolutely, just like that. I've done the following in a few scripts just to let me group different sections together so I can move them as a group:
Ya know, I don't care what they write about you on the Canadian wall. You're alright in my book.

I think that I'm beginning to get the hang of it... not quite as intuitive as I was thinking it was, so it involves more indepth planning to get everything to lay out correctly. It took me quite a bit of head scratching to figure out that the tabs themselves have to be on every 'page', or they disappear and you can't get them back. I would've thought those to be something that you couldn't change. Oh well, now I have a new bald spot to shine, so life goes on.

Thanks, Lokasenna.
__________________
"But be ye doers of the word, and not hearers only, deceiving your own selves."
tXShooter is offline   Reply With Quote
Old 04-27-2019, 10:37 AM   #460
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

They shouldn't need to be included in each set - just put the tabs on their own z and don't include it in any of the sets, and it will always be there.
__________________
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 04-27-2019, 01:15 PM   #461
tXShooter
Human being with feelings
 
tXShooter's Avatar
 
Join Date: Aug 2017
Posts: 336
Default

Quote:
Originally Posted by Lokasenna View Post
They shouldn't need to be included in each set - just put the tabs on their own z and don't include it in any of the sets, and it will always be there.
DOH!!

Thank you.
__________________
"But be ye doers of the word, and not hearers only, deceiving your own selves."
tXShooter is offline   Reply With Quote
Old 05-03-2019, 11:03 PM   #462
deeb
Human being with feelings
 
deeb's Avatar
 
Join Date: Feb 2017
Posts: 4,812
Default

Lokasenna! i will start my first Gui in V2 and i found one issue:
I have dual boot, and both systems use same reaper.

I noticed that reaper.GetExtState("Lokasenna_GUI", "lib_path_v2") does not consider the Volume in mac, so if i try to use the script from a second boot system it gives error, because it tries to load the file from the local drive.

At least in OSX it should consider also this: "/Volumes/MyHardDriveName" and then the normal path as it now.
deeb is offline   Reply With Quote
Old 05-03-2019, 11:26 PM   #463
deeb
Human being with feelings
 
deeb's Avatar
 
Join Date: Feb 2017
Posts: 4,812
Default

also a request which probably takes a lot of work: warping text in text editor would nice : )
deeb is offline   Reply With Quote
Old 05-04-2019, 10:29 AM   #464
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
Lokasenna! i will start my first Gui in V2 and i found one issue:
I have dual boot, and both systems use same reaper.

I noticed that reaper.GetExtState("Lokasenna_GUI", "lib_path_v2") does not consider the Volume in mac, so if i try to use the script from a second boot system it gives error, because it tries to load the file from the local drive.

At least in OSX it should consider also this: "/Volumes/MyHardDriveName" and then the normal path as it now.
Certainly a reasonable thing to do. Linux could probably stand to do something similar for /home/username.

Can you look in your REAPER/reaper-extstate.ini folder for the path that it's currently storing (in the key [Lokasenna_GUI] -> lib_path_v2), just so I can see what would need to be changing?

Quote:
Originally Posted by deeb View Post
also a request which probably takes a lot of work: warping text in text editor would nice : )
You're right, it would be a lot of work. When I was writing the TextEditor I looked at using proportional fonts and allowing wrapping, but it gets a LOT harder to figure out where the caret and selection need to go since I can't just do "this line, this column".

I do have it on my list of things that would be nice for V3, but because of the difficulty I wouldn't get your hopes up.
__________________
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 05-04-2019, 10:38 AM   #465
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

Just a followup for my response to tXShooter above, here's an easy-ish way to position multiple elements with respect to a reference point and get them spaced appropriately.

Code:
local topRow = {
  {
    caption = "Main",
    func = insertKeyswitch,
    params = {36},
  },
  {
    caption = "CC1",
    func = insertKeyswitch,
    params = {37},
  },
  ...etc...
}

local topGap = -1
local topWidth = 45
local btnHeight = 17

local topRef = {
  x = function(i) return (topWidth + topGap) * i end,
  y = 0,
  w = topWidth,
  h = btnHeight
}

GUI.name = "My SCript"
GUI.x = 0
GUI.y = 0
GUI.w = topRef.x(#topRow)
GUI.h = 480
GUI.anchor, GUI.corner = "mouse", "C"

local processedTopRow = {}
for i, elm in ipairs(topRow) do
  elm.type = "Button"
  elm.z = 1
  elm.x = topRef.x(i - 1)
  elm.y = topRef.y
  elm.w = topRef.w
  elm.h = topRef.h
  elm.image = "top_"..elm.caption

  processedTopRow["btn_1_"..i] = elm
end
GUI.CreateElms(processedTopRow)
In this case I have a bunch of buttons to lay out in certain grids and rows, which are all identical except for their captions and onClick functions, so I put the unique bits in a table and then looped over it to create the actual elements. Radial Menu does something similar for populating the Context tab.

By structuring all of the element groups this way, I can set the group positions, element spacing, and even the window size just by changing the gap, width, and height values.
__________________
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 05-04-2019, 11:06 AM   #466
deeb
Human being with feelings
 
deeb's Avatar
 
Join Date: Feb 2017
Posts: 4,812
Default

Quote:
Originally Posted by Lokasenna View Post
Certainly a reasonable thing to do. Linux could probably stand to do something similar for /home/username.

Can you look in your REAPER/reaper-extstate.ini folder for the path that it's currently storing (in the key [Lokasenna_GUI] -> lib_path_v2), just so I can see what would need to be changing?
Code:
[Lokasenna_GUI]
lib_path_v2=/Applications/REAPER/Scripts/ReaTeam Scripts/Development/Lokasenna_GUI v2/Library/
in the end i need something like:
Code:
/Volumes/MyHardDriveName/Applications/REAPER/Scripts/ReaTeam Scripts/Development/Lokasenna_GUI v2/Library/
probably it is trickier then looked at first sight : ) even :
reaper.GetExePath()
reaper.GetProjectPath()

in OSX / Linux (i guess... ) don't consider the volume where it is at! contrasting with windows in which the drive letter is exposed : (
example for getExePath -> returns path of REAPER.exe (not including EXE), i.e. C:\Program Files\REAPER

Quote:
Originally Posted by Lokasenna View Post
it would be a lot of work. When I was writing the TextEditor I looked at using proportional fonts and allowing wrapping, but it gets a LOT harder to figure out where the caret and selection need to go since I can't just do "this line, this column".

I do have it on my list of things that would be nice for V3, but because of the difficulty I wouldn't get your hopes up.
Yep yep! i understand! Thanks
deeb is offline   Reply With Quote
Old 05-04-2019, 11:26 AM   #467
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

Hmm... if those aren't getting the full path either then I'm not sure it's doable.

As a workaround, what happens if you put the correct path into the .ini yourself?
__________________
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 05-04-2019, 11:47 AM   #468
deeb
Human being with feelings
 
deeb's Avatar
 
Join Date: Feb 2017
Posts: 4,812
Default

Quote:
Originally Posted by Lokasenna View Post
Hmm... if those aren't getting the full path either then I'm not sure it's doable.

As a workaround, what happens if you put the correct path into the .ini yourself?
loads everything fine!
deeb is offline   Reply With Quote
Old 05-04-2019, 11:56 AM   #469
deeb
Human being with feelings
 
deeb's Avatar
 
Join Date: Feb 2017
Posts: 4,812
Default

i'd sugest something like this:
[Lokasenna_GUI]
lib_path_v2=/Applications/REAPER/Scripts/ReaTeam Scripts/Development/Lokasenna_GUI v2/Library/
lib_Volume="" <- in order to be changed manually

as default , and then in the "Set Lokasenna_GUI v2 library path.lua":
local script_path = lib_Volume .. info.source:match[[^@?(.*[\/])[^\/]-$]]

Anyway not a big deal, .. and maybe it's just me using this way! Thanks!
deeb is offline   Reply With Quote
Old 05-06-2019, 06:31 PM   #470
tXShooter
Human being with feelings
 
tXShooter's Avatar
 
Join Date: Aug 2017
Posts: 336
Default

Quote:
Originally Posted by Lokasenna View Post
Just a followup for my response to tXShooter above, here's an easy-ish way to position multiple elements with respect to a reference point and get them spaced appropriately.

By structuring all of the element groups this way, I can set the group positions, element spacing, and even the window size just by changing the gap, width, and height values.
That's bloody brilliant!

(What does the params {36} do?)


Also, I had an issue a while back that I never got resolved, dealing with images. If you get a chance, would you look over this thread? https://forum.cockos.com/showthread.php?t=214610

Thank you.
__________________
"But be ye doers of the word, and not hearers only, deceiving your own selves."
tXShooter is offline   Reply With Quote
Old 05-06-2019, 08:44 PM   #471
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

Quote:
Originally Posted by tXShooter View Post
That's bloody brilliant!

(What does the params {36} do?)
When you create a button the normal way:

Code:
GUI.Button:new("my_btn", 1, 32, 32, 64, 22, "Click me!", do_the_thing, 4)
...any parameters given after do_the_thing are bundled and then passed to that function when the button calls it.

When creating a button as an object:

Code:
GUI.Button:new("my_btn", {
  z = 1,
  x = 32,
  y = 32,
  w = 64,
  h = 22,
  caption = "Click me!",
  func = do_the_thing,
  params = {4},
})
... you have to bundle the parameters up yourself into a table and provide it as params. For the script the code above is from, the function inserts a MIDI note with a few specific values, and the parameter is just the note number.
__________________
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 05-07-2019, 05:56 PM   #472
tXShooter
Human being with feelings
 
tXShooter's Avatar
 
Join Date: Aug 2017
Posts: 336
Default

Quote:
Originally Posted by Lokasenna View Post
For the script the code above is from, the function inserts a MIDI note with a few specific values, and the parameter is just the note number.
You've piqued my interest on that one. Isn't MIDI a form of OSC? I thought that I read how they were somewhat interchangeable... or is my head full of foolishness once again?

That being brought up, do you know of anyway to communicate with a device via OSC?
__________________
"But be ye doers of the word, and not hearers only, deceiving your own selves."
tXShooter is offline   Reply With Quote
Old 05-07-2019, 06:37 PM   #473
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

Quote:
Originally Posted by tXShooter View Post
You've piqued my interest on that one. Isn't MIDI a form of OSC? I thought that I read how they were somewhat interchangeable... or is my head full of foolishness once again?
The MIDI spec was originally set out in the '80s and OSC came about in the late '90s as a technically-better alternative. Obviously MIDI continues to be on top, and an updated MIDI spec is going through testing/approval/etc right now.

The protocols are completely different, but I think a lot of information can be translated fairly easily. OSC offers higher resolution and few other things MIDI can't do.

https://www.linuxjournal.com/content/introduction-osc

Quote:
That being brought up, do you know of anyway to communicate with a device via OSC?
I've never had occasion to look into it. The script API only gives us:

Code:
reaper.OscLocalMessageToHost(string message, optional number valueIn)
Send an OSC message directly to REAPER. The value argument may be NULL. The message will be matched against the default OSC patterns. Only supported if control surface support was enabled when installing REAPER.
You can also get some information if the script was run via an OSC command using reaper.get_action_context().
__________________
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 05-20-2019, 12:55 AM   #474
deeb
Human being with feelings
 
deeb's Avatar
 
Join Date: Feb 2017
Posts: 4,812
Default

Hello Lokasenna! Hope you good!
Consider this 2 suggestions that IMO would be nice to add in future

1) Listbox does not receive keyboard inputs ( up and down) like other elements like menubox after clicked!

2) Would be Also nice if menu box when last focus to be able to use up and down keys to change the selected "thing", without need to click it again. Example:



In here , after the "rectangle with the list disappears", would be nice if up and down key still work to change it.

Probably this concept could be applied into other elements! i don't know! Anyway .. just saying : )

Thanks!
deeb is offline   Reply With Quote
Old 05-20-2019, 04:43 AM   #475
deeb
Human being with feelings
 
deeb's Avatar
 
Join Date: Feb 2017
Posts: 4,812
Default

Just noticed a strange behaviour when pressing shift + (Left or Right) keys to select text (OSX 10.9.5) . It just selects 1 character. Which does not happen in TextEditor


Last edited by deeb; 05-20-2019 at 05:09 AM.
deeb is offline   Reply With Quote
Old 05-20-2019, 07:38 AM   #476
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

- Good suggestions. I've added them to my list.

- Thanks for catching that bug, I'll see if I can get a fix out later today.
__________________
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 05-20-2019, 09:15 AM   #477
woodslanding
Human being with feelings
 
woodslanding's Avatar
 
Join Date: Mar 2007
Location: Denver, CO
Posts: 633
Default Pleased as punch

I have been using the code posted at the image question thread to get my image widget on, and it is delightful!!

I'll post my widgets when they are working well. Right now I have two. One a simple image button that sends a command. The other a multi-use widget that either functions as a slider or a cycle button, depending on a flag. They are missing a lot of flexibility, as I have pretty specific use cases, but they might be useful to someone, at least as a starting point.

Meantime, I have a gfx question. I use images with alpha so that I can put a simple background color behind them. Wondering if and how I can do this with gfx. Can I blit multiple times to the same space? Or do I need to concatenate the images somehow first?
__________________
eric moon
Very Stable Genius
https://gogolab.com/
woodslanding is offline   Reply With Quote
Old 05-20-2019, 10:29 AM   #478
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

It's just a matter of blitting/drawing your background and then blitting/drawing the transparent image on top.

- For a general background image with all of your widgets on top, each widget would just blit its image to the layer buffer as normal. If you look at the knob below, you can see that the tick marks are overlaid on the metal background.

- If you had multiple images to composite into one widget, you could either blit them to the layer buffer one after the other (the label at the top of the image below does this with Body -> Text -> Overlay), or just do it once to the widget's buffer in your init method and then blit from there to the layer buffer as normal when drawing.

__________________
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 05-20-2019, 11:19 AM   #479
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

Update: Fixed the textbox bug mentioned a few posts ago.
__________________
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 05-20-2019, 08:32 PM   #480
woodslanding
Human being with feelings
 
woodslanding's Avatar
 
Join Date: Mar 2007
Location: Denver, CO
Posts: 633
Default

Wow, this is just rockin along!!

question: I want to create a bunch of similar items that each address a different track... I can create unique names for them by concatenating a string, but then I don't know how to access them.

Code:
for i = 1,trackcount do
    pos = {z=1,x=0,y=track*trackheight,w=48,h=40}
    vals = {trk=i,min=0,max=3,default=0,sens=1}
    GUI.New("ns_ctl_"..i,"IControl","NSControl",4,false, pos,vals,"")
    function GUI.elms.ns_ctl:onmouseup() --how do I refer to ns_ctl_1 programatically ???
        setNotesource(GUI.elms.ns_ctl.trk, GUI.elms.ns_ctl:val())--can I use 'self' here somehow?
        GUI.IControl.onmouseup(self)
    end	
end
Seems like something Lua would be good at, but I'm a little to green to grok it.
__________________
eric moon
Very Stable Genius
https://gogolab.com/
woodslanding 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 02:50 AM.


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