|
|
|
03-17-2020, 11:39 AM
|
#681
|
Human being with feelings
Join Date: May 2018
Location: Los Angeles
Posts: 1,721
|
Total newbie beginner question (please speak slowly ).
Using the awesome GUI builder, I created a simple knob and button to learn how to get values from the GUI.
All I want to do is have the script give me the knob value when I hit the Get Val button.
Can someone give me a simple example of how I would be able to this? I've scanned (admittedly not deeply) the documentation. And something is clearly not registering with me. For example, there is the GUI.init() function and the GUI.main() function, but there is no actual function listed in the code. Sorry for being so clueless. I think if someone just gave me the few lines of code to get the knob value when the button is pushed... that would really help me.
Here's the code the GUI builder gave me:
Code:
-- Script generated by Lokasenna's GUI Builder
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 install 'Lokasenna's GUI library v2 for Lua', available on ReaPack, then run the 'Set Lokasenna_GUI v2 library path.lua' script in your Action List.", "Whoops!", 0)
return
end
loadfile(lib_path .. "Core.lua")()
GUI.req("Classes/Class - Button.lua")()
GUI.req("Classes/Class - Knob.lua")()
-- If any of the requested libraries weren't found, abort the script.
if missing_lib then return 0 end
GUI.name = "AK Test GUI"
GUI.x, GUI.y, GUI.w, GUI.h = 0, 0, 640, 480
GUI.anchor, GUI.corner = "mouse", "C"
GUI.New("Knob1", "Knob", {
z = 11,
x = 80,
y = 80,
w = 40,
caption = "Knob1",
min = 0,
max = 10,
default = 5,
inc = 1,
vals = true,
font_a = 3,
font_b = 4,
col_txt = "txt",
col_head = "elm_fill",
col_body = "elm_frame",
cap_x = 0,
cap_y = 0
})
GUI.New("Get_val", "Button", {
z = 11,
x = 64,
y = 192,
w = 48,
h = 24,
caption = "Get Val",
font = 3,
col_txt = "txt",
col_fill = "elm_frame"
})
GUI.Init()
GUI.Main()
__________________
Cheers... Andrew K
Reaper v6.80+dev0621 - June 21 2023 Catalina Mac Mini 2020 6 core i7 64GB RAM OS: Catalina 4K monitor RME RayDAT card with Sync Card and extended Light Pipe.
|
|
|
03-17-2020, 11:59 AM
|
#682
|
Human being with feelings
Join Date: Mar 2013
Posts: 5,857
|
Here's an updated example:
Code:
-- Script generated by Lokasenna's GUI Builder
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 install 'Lokasenna's GUI library v2 for Lua', available on ReaPack, then run the 'Set Lokasenna_GUI v2 library path.lua' script in your Action List.", "Whoops!", 0)
return
end
loadfile(lib_path .. "Core.lua")()
GUI.req("Classes/Class - Label.lua")()
GUI.req("Classes/Class - Button.lua")()
GUI.req("Classes/Class - Knob.lua")()
-- If any of the requested libraries weren't found, abort the script.
if missing_lib then return 0 end
GUI.name = "AK Test GUI"
GUI.x, GUI.y, GUI.w, GUI.h = 0, 0, 640, 480
GUI.anchor, GUI.corner = "mouse", "C"
local function GetValue()
local knobValue = GUI.Val("Knob1")
GUI.Val("Label1", knobValue)
end
GUI.New("Knob1", "Knob", {
z = 11,
x = 80,
y = 80,
w = 40,
caption = "Knob1",
min = 0,
max = 10,
default = 5,
inc = 1,
vals = true,
font_a = 3,
font_b = 4,
col_txt = "txt",
col_head = "elm_fill",
col_body = "elm_frame",
cap_x = 0,
cap_y = 0,
})
GUI.New("Label1", "Label", {
z = 11,
x = 150,
y = 192,
caption = "Label1",
font = 2,
color = "txt",
bg = "wnd_bg",
shadow = false
})
GUI.New("Get_val", "Button", {
z = 11,
x = 64,
y = 192,
w = 48,
h = 24,
caption = "Get Val",
font = 3,
col_txt = "txt",
col_fill = "elm_frame",
func = GetValue
})
GUI.Init()
GUI.Main()
The func parameter lets you define which function is called on a button press.
|
|
|
03-17-2020, 12:17 PM
|
#683
|
Human being with feelings
Join Date: May 2018
Location: Los Angeles
Posts: 1,721
|
@solger,
Thanks a million!!
So, any GUI element that I want to run a function on when touched is simply a matter of adding the line func = my_function and then (of course) writing:
function my_function ()
do something...
end
That's it? Does it have to be a "local" function?
Thanks!!
__________________
Cheers... Andrew K
Reaper v6.80+dev0621 - June 21 2023 Catalina Mac Mini 2020 6 core i7 64GB RAM OS: Catalina 4K monitor RME RayDAT card with Sync Card and extended Light Pipe.
|
|
|
03-17-2020, 12:27 PM
|
#684
|
Human being with feelings
Join Date: Mar 2013
Posts: 5,857
|
Quote:
Originally Posted by Thonex
@solger,
Thanks a million!!
So, any GUI element that I want to run a function on when touched is simply a matter of adding the line func = my_function and then (of course) writing:
function my_function ()
do something...
end
That's it?
|
Well, it basically depends on the element what behaviors are available.
In case of a Button it's func (left click) and r_func (right click) in V2: https://github.com/jalovatt/Lokasenn...ki/2.00-Button
Or func and rightFunc in V3: https://jalovatt.github.io/scythe/#/gui/elements/Button
Quote:
Does it have to be a "local" function?
|
It's mainly a question about code efficiency and optimization. Some info links as example:
This tutorial should also be helpful in general: https://www.admiralbumblebee.com/mus...-Tutorial.html
|
|
|
03-17-2020, 12:37 PM
|
#685
|
Human being with feelings
Join Date: May 2018
Location: Los Angeles
Posts: 1,721
|
Quote:
Originally Posted by solger
|
Thanks solger!!
OK... I think I know enough now to hurt myself
Brilliant... I think this is exactly what I needed.
Cheers!
__________________
Cheers... Andrew K
Reaper v6.80+dev0621 - June 21 2023 Catalina Mac Mini 2020 6 core i7 64GB RAM OS: Catalina 4K monitor RME RayDAT card with Sync Card and extended Light Pipe.
|
|
|
03-17-2020, 01:21 PM
|
#686
|
Human being with feelings
Join Date: May 2018
Location: Los Angeles
Posts: 1,721
|
OK... last question for the day!
Is it possible to get a knob value in realtime within the GUI element code block?
If I add to the slider GUI code the following at the last line:
Code:
func = get_slider_val
and then use this function
Code:
function get_slider_val ()
slider = GUI.Val ("Slider1")
GUI.Val("Label1", slider)
end
Nothing happens.
If I use this code outside the slider GUI code block:
Code:
GUI.freq = .5
GUI.func = get_slider_val
then that works, however it may be overkill CPU wise.
... nothing else seems to work. Of course I can read the slider value from outside of the GUI.New("Slider1", "Slider"... code block, but unlike the button, I can't get instant feedback on the slider. Same with the knob.
So, my only solution for realtime polling of a slider of knob is GUI.func?
__________________
Cheers... Andrew K
Reaper v6.80+dev0621 - June 21 2023 Catalina Mac Mini 2020 6 core i7 64GB RAM OS: Catalina 4K monitor RME RayDAT card with Sync Card and extended Light Pipe.
Last edited by Thonex; 03-17-2020 at 01:48 PM.
|
|
|
03-18-2020, 07:58 AM
|
#687
|
Human being with feelings
Join Date: Mar 2013
Posts: 5,857
|
Quote:
Originally Posted by Thonex
Is it possible to get a knob value in realtime within the GUI element code block? ...
... So, my only solution for realtime polling of a slider of knob is GUI.func?
|
You can also try using a reaper.defer function for this. See the code examples in this thread: https://forum.cockos.com/showthread.php?t=168270
|
|
|
03-18-2020, 01:31 PM
|
#688
|
Human being with feelings
Join Date: May 2018
Location: Los Angeles
Posts: 1,721
|
Quote:
Originally Posted by solger
|
Thanks solger.
Yeah... ok. I was hoping to stay away from defer functions. I hate using cycles when I don't have to
Is there any consensus whether GUI.func or defer is more CPU efficient? I believe defer by default is about every 30ms. IIRC, defer and GUI.func both have freq (or some kind of timing) control.
__________________
Cheers... Andrew K
Reaper v6.80+dev0621 - June 21 2023 Catalina Mac Mini 2020 6 core i7 64GB RAM OS: Catalina 4K monitor RME RayDAT card with Sync Card and extended Light Pipe.
|
|
|
03-18-2020, 02:01 PM
|
#689
|
Human being with feelings
Join Date: Mar 2013
Posts: 5,857
|
Quote:
Originally Posted by Thonex
Is there any consensus whether GUI.func or defer is more CPU efficient? I believe defer by default is about every 30ms. IIRC, defer and GUI.func both have freq (or some kind of timing) control.
|
I'd say it probably depends on the use-case (like when and where need certain things to be updated in the GUI, running in the background, etc.)
This thread has some interesting info which might be helpful (like, for instance, post #16): https://forum.cockos.com/showthread.php?t=213212
Last edited by solger; 03-18-2020 at 02:11 PM.
|
|
|
03-18-2020, 02:16 PM
|
#690
|
Human being with feelings
Join Date: May 2018
Location: Los Angeles
Posts: 1,721
|
Quote:
Originally Posted by solger
I'd say it probably depends on the use-case (like when and where need certain things to be updated in the GUI, running in the background, etc.)
This thread has some interesting info which might be helpful (like, for instance, post #16): https://forum.cockos.com/showthread.php?t=213212
|
Ahaa.... I thought that maybe the GUI.func was wrapped in a defer loop.
You've been very helpful solger!
Thanks.
__________________
Cheers... Andrew K
Reaper v6.80+dev0621 - June 21 2023 Catalina Mac Mini 2020 6 core i7 64GB RAM OS: Catalina 4K monitor RME RayDAT card with Sync Card and extended Light Pipe.
|
|
|
03-20-2020, 08:17 PM
|
#691
|
Human being with feelings
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
|
Hey folks,
I'm really sorry to do this, but I don't think I can keep going with this project.
Between my day job and my family there just isn't enough time left over for all of the things I'd like to get done. Hell, I haven't even had time to use Reaper for anything other than working on the GUI in a little over a year, and I don't see that changing anytime soon.
Additionally, I don't think I'll be frequenting the forum. As I said, I don't even have time to do audio stuff and if I sign in I'll just stress myself out with all of the things I wish I could do for the GUI, Radial Menu, Theory Helper, and my other scripts, AND the long list of cool ideas I haven't even gotten to.
This might change one day, of course. I signed off for a year, I think, quite a while back and yet here we are.
Cheers.
|
|
|
03-21-2020, 12:14 AM
|
#692
|
Human being with feelings
Join Date: May 2018
Location: Los Angeles
Posts: 1,721
|
Quote:
Originally Posted by Lokasenna
Hey folks,
I'm really sorry to do this, but I don't think I can keep going with this project.
Between my day job and my family there just isn't enough time left over for all of the things I'd like to get done. Hell, I haven't even had time to use Reaper for anything other than working on the GUI in a little over a year, and I don't see that changing anytime soon.
Additionally, I don't think I'll be frequenting the forum. As I said, I don't even have time to do audio stuff and if I sign in I'll just stress myself out with all of the things I wish I could do for the GUI, Radial Menu, Theory Helper, and my other scripts, AND the long list of cool ideas I haven't even gotten to.
This might change one day, of course. I signed off for a year, I think, quite a while back and yet here we are.
Cheers.
|
I'm sure I'm not speaking for myself when I say we'll all miss you when you're not around... and will all be eternally grateful for your amazing contributions!
Take care of yourself first. Get rid of any stress... it's not worth it. We'll always be here when/if you're ready to come back... and thanks again for all you've done!
Cheers,
Andrew K
__________________
Cheers... Andrew K
Reaper v6.80+dev0621 - June 21 2023 Catalina Mac Mini 2020 6 core i7 64GB RAM OS: Catalina 4K monitor RME RayDAT card with Sync Card and extended Light Pipe.
|
|
|
03-21-2020, 01:58 AM
|
#693
|
Human being with feelings
Join Date: Jan 2010
Location: Fjugesta, Sweden
Posts: 813
|
Quote:
Originally Posted by Thonex
I'm sure I'm not speaking for myself when I say we'll all miss you when you're not around... and will all be eternally grateful for your amazing contributions!
Take care of yourself first. Get rid of any stress... it's not worth it. We'll always be here when/if you're ready to come back... and thanks again for all you've done!
|
@Lokasenna
+1
Take care and thanks for all the wonderful things you done and all the help you have given.
Regards
Thomas
|
|
|
03-21-2020, 02:31 AM
|
#694
|
Human being with feelings
Join Date: Apr 2014
Location: The place that's round on the ends and high in the middle
Posts: 247
|
Lokasenna,
Hopefully you'll see this just so you'll know how much your amazing contributions have been appreciated by users like myself. Health and happiness and congratulations on your wise decision to focus upon the really important things in life.
A sincere thank you from me (and I'm sure countless others) to you.
|
|
|
03-21-2020, 04:06 AM
|
#695
|
Human being with feelings
Join Date: Mar 2013
Posts: 5,857
|
+1 here, as well.
Take care and thanks for all your work and time, so far!
|
|
|
04-07-2020, 03:20 PM
|
#696
|
Human being with feelings
Join Date: Oct 2017
Location: Black Forest
Posts: 5,067
|
Quote:
Originally Posted by Lokasenna
Hey folks,
I'm really sorry to do this, but I don't think I can keep going with this project.
Between my day job and my family there just isn't enough time left over for all of the things I'd like to get done. Hell, I haven't even had time to use Reaper for anything other than working on the GUI in a little over a year, and I don't see that changing anytime soon.
Additionally, I don't think I'll be frequenting the forum. As I said, I don't even have time to do audio stuff and if I sign in I'll just stress myself out with all of the things I wish I could do for the GUI, Radial Menu, Theory Helper, and my other scripts, AND the long list of cool ideas I haven't even gotten to.
This might change one day, of course. I signed off for a year, I think, quite a while back and yet here we are.
Cheers.
|
Man, thats so sad to read. Thank you for all your work and for getting me into refactoring. Hope to see you anyway, from time to time!
|
|
|
04-11-2020, 02:57 PM
|
#697
|
Human being with feelings
Join Date: May 2018
Location: Los Angeles
Posts: 1,721
|
Does anyone know what to "Get" a MenuBox's current value?
I've tried to message out the optarray and retval of a menubox with a button function and I keep getting nil.
I saw this in the documentation, but no example of how to use it:
Menubox:val([newval])
Get or set the selected item
Any ideas?
__________________
Cheers... Andrew K
Reaper v6.80+dev0621 - June 21 2023 Catalina Mac Mini 2020 6 core i7 64GB RAM OS: Catalina 4K monitor RME RayDAT card with Sync Card and extended Light Pipe.
|
|
|
04-11-2020, 03:11 PM
|
#698
|
Human being with feelings
Join Date: May 2018
Location: Los Angeles
Posts: 1,721
|
Quote:
Originally Posted by Thonex
Does anyone know what to "Get" a MenuBox's current value?
I've tried to message out the optarray and retval of a menubox with a button function and I keep getting nil.
I saw this in the documentation, but no example of how to use it:
Menubox:val([newval])
Get or set the selected item
Any ideas?
|
Ugh... never mind... I forgot to use the GUI.Val("Menubox1") command.
__________________
Cheers... Andrew K
Reaper v6.80+dev0621 - June 21 2023 Catalina Mac Mini 2020 6 core i7 64GB RAM OS: Catalina 4K monitor RME RayDAT card with Sync Card and extended Light Pipe.
|
|
|
04-22-2020, 05:24 PM
|
#699
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,630
|
Does somebody have an email address of lokasenna and could pm it to me?
Wanted to ask him, if I could overtake development of guilib v3 aka Scythe as part of the Ultraschall-Api. Wouldn't do it without his permission.
|
|
|
04-22-2020, 08:34 PM
|
#700
|
Human being with feelings
Join Date: Mar 2007
Location: Denver, CO
Posts: 633
|
I wonder if you could contact him through gitHub.
I know he was soliciting help, and the lack of that may have impacted his decision to let it go....
It's hard to imagine him having a problem with you forking it. But do as you see best. I'm hoping to use it more, so I'd like to see it developed.
|
|
|
04-23-2020, 12:35 AM
|
#701
|
Human being with feelings
Join Date: Feb 2020
Posts: 9
|
Quote:
Originally Posted by Meo-Ada Mespotine
Does somebody have an email address of lokasenna and could pm it to me?
Wanted to ask him, if I could overtake development of guilib v3 aka Scythe as part of the Ultraschall-Api. Wouldn't do it without his permission.
|
It is nice to ask before forking it.
Nevertheless, if the git repo is forkable and you don't have an answer soon, I think you should do it.
Everybody will be happy to see someone pursuing his great job!
|
|
|
04-23-2020, 08:17 AM
|
#702
|
Human being with feelings
Join Date: Jan 2010
Location: Fjugesta, Sweden
Posts: 813
|
Quote:
Originally Posted by Meo-Ada Mespotine
Does somebody have an email address of lokasenna and could pm it to me?
Wanted to ask him, if I could overtake development of guilib v3 aka Scythe as part of the Ultraschall-Api. Wouldn't do it without his permission.
|
Dont have email to Lokasenna, just wanna say it would be wonderful if you could keep it alive if Lokasenna dont return!
Regards
Thomas
|
|
|
04-23-2020, 08:32 AM
|
#703
|
Human being with feelings
Join Date: Feb 2017
Posts: 4,820
|
+1 big thank you ! Wish you all the best and hope you keep doing music or play your instrument ! When you have more time then spend time on making even more
Who cares about code! Jking /kind off
__________________
🙏🏻
|
|
|
04-28-2020, 04:41 AM
|
#704
|
Human being with feelings
Join Date: Apr 2020
Posts: 66
|
Hi all,
How to toggle the col_fill propertie after clicking a button from the lokasenna GUI library?
PHP Code:
elms["button_"..k] = {
type = "Button",
z = (#toolbar_buttons - k) + 1,
x = ((k - 1) % buttons_per_row) * (button_width + button_h_spacer),
y = math.floor((k - 1) / buttons_per_row) * (button_height + button_v_spacer),
w = button_width,
h = button_height,
col_txt = "black",
col_fill = "red",
font=4,
func = toggle_bypass,
caption = v.label,
params = {v.track,v.slot,v.col_fill},
tooltip = ""
}
Kind regards,
Jan Flikweert
Last edited by Jan Flikweert; 04-28-2020 at 04:47 AM.
|
|
|
04-28-2020, 06:09 AM
|
#705
|
Human being with feelings
Join Date: Mar 2013
Posts: 5,857
|
Quote:
Originally Posted by Jan Flikweert
How to toggle the col_fill propertie after clicking a button from the lokasenna GUI library?
|
Have a look at the different code examples in this thread (post #2, #17, #18): https://forum.cockos.com/showthread.php?t=234642
|
|
|
04-28-2020, 06:48 AM
|
#706
|
Human being with feelings
Join Date: Apr 2020
Posts: 66
|
Hi,
Thanks for your reply.
This did it:
PHP Code:
function GUI.Button:onmouseup() self.state = 0 -- If the mouse was released on the button, run func if GUI.IsInside(self, GUI.mouse.x, GUI.mouse.y) then self.func(table.unpack(self.params)) self.col_fill = self.col_fill == "elm_frame" and "green" or "elm_frame" -- ADDED THIS end self:redraw() self:init() -- ADDED THIS end
Quote:
Originally Posted by solger
|
Kind regards,
Jan Flikweert
Last edited by Jan Flikweert; 04-28-2020 at 07:07 AM.
|
|
|
05-14-2020, 03:40 AM
|
#707
|
Human being with feelings
Join Date: Oct 2017
Location: Black Forest
Posts: 5,067
|
Im using the Loka GUI to open a settings dialog for a defer script. The dialog is opened with the key o and triggers:
Code:
GUI.Init()
GUI.Main()
The window opens correctly on the first press. But when I close it and re-open it, it crashes (have to get the actual error log). Any ideas what could cause this?
|
|
|
05-19-2020, 11:58 AM
|
#708
|
Human being with feelings
Join Date: May 2020
Posts: 190
|
Hey everyone,
Out of curiosity, does anyone know if there is a script hook I can utilize for when a tab changes state? I know I can get the state at any point using GUI.Val, but I was hoping there might be something that already does this in the background so I can flip a bool every time the tab changes, affecting the way that my main script works.
|
|
|
05-24-2020, 04:20 PM
|
#709
|
Banned
Join Date: Dec 2018
Posts: 642
|
Scaling a GUI window by dragging corner
Is there an easy way in Lokasenna GUI to automatically scale all the contents in a GUI window when the corner is dragged?
Ideally this would be proportional scaling in both x and y directions...
|
|
|
05-25-2020, 01:30 AM
|
#710
|
Human being with feelings
Join Date: Sep 2014
Posts: 2,643
|
https://forum.cockos.com/showthread....14#post2215614
I use +x1 and +y1 then I can reposition all the buttons by changing the x,y value
you could maybe add to the size & height & font the same way ?
Code:
GUI.New("count_in_btn", "Button", 3, 16+x1, 65+y1, 70, 20,
I did the font scaling in another GUI:
|
|
|
06-04-2020, 10:40 PM
|
#711
|
Human being with feelings
Join Date: Feb 2017
Posts: 4,820
|
In version 3, does anyone knows how to override the font colors and font sizes without changing directly core.lua?
__________________
🙏🏻
|
|
|
06-06-2020, 10:57 PM
|
#712
|
Human being with feelings
Join Date: Feb 2017
Posts: 4,820
|
in V3 - scythe, Does anyone have a recommendation of good practice for overriding:
function Window:handleWindowEvents()
?
I would like to have my own logic in this function, without compromising the future updates.
Thank you!
__________________
🙏🏻
|
|
|
06-07-2020, 11:40 PM
|
#713
|
Human being with feelings
Join Date: Feb 2017
Posts: 4,820
|
Also,
in V3 - scythe, Does anyone have a recommendation of good practice for overriding event methods from GUI Elements?
In V1 and V2 this used to work:
Code:
GUI.MyListbox = GUI.Listbox
GUI.MyListbox.on_mouseup= GUI.MyListbox.onmouseup
function GUI.MyFolders:onmouseup()
self:on_mouseup()
do_something()
end
in V3 i am trying using:
Code:
GUI.elementClasses.MyListbox =GUI.elementClasses.Listbox
GUI.elementClasses.MyListbox.on_mouseup= GUI.elementClasses.MyListbox.onMouseUp
function GUI.elementClasses.MyListbox:onMouseUp(state)
self:on_mouseup(state)
end
but this seems to mess up with the original ListBox and It works if we override only one Listbox, so that when creating example: "MySecondListBox" with the same method, then in the GUI doing click on MyListbox or MySecondListBox GUI, gives error:
Code:
Error: MyElements.lua:19: stack overflow
Stack traceback:
MyElements.lua:19: in function 'gui.elements.Listbox.on_mouseup'
It's calling the "Listbox.on_mouseup" instead of the "MyListbox.on_mouseup"
__________________
🙏🏻
Last edited by deeb; 06-08-2020 at 12:32 AM.
|
|
|
06-08-2020, 10:11 AM
|
#714
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,630
|
A total noob-question: When using v3(but probably with v2 as well), what is the purpose of GUI.createLayer?
Means, what is a layer in the sense of Lokasenna's Gui-Lib, the benefits and importances?
Is it like a z-buffer, so I can put together numerous gui-elements into one layer and turn it on and off, when working with tabs? Or does one gui-element need its own layer?
|
|
|
06-08-2020, 11:24 AM
|
#715
|
Human being with feelings
Join Date: Mar 2013
Posts: 5,857
|
Quote:
Originally Posted by Meo-Ada Mespotine
A total noob-question: When using v3(but probably with v2 as well), what is the purpose of GUI.createLayer?
Means, what is a layer in the sense of Lokasenna's Gui-Lib, the benefits and importances?
Is it like a z-buffer, so I can put together numerous gui-elements into one layer and turn it on and off, when working with tabs?
|
Yeah, that's basically it.
Each element has a specific layer (z-value) assigned. A tab, for instance, can have multiple layers assigned (to control which elements are shown on a specific tab).
In case you haven't already seen it, some details and short examples can be found in the GUI Wiki pages:
|
|
|
06-08-2020, 06:46 PM
|
#716
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,630
|
Thanks.
Another question: When I use this script and doubleclick one of the buttons, they stay "clicked". Is this intentional behavior as I doubleclicked at it or rather a bug?
I use Scythe in this example.
Code:
loadfile(libPath .. "scythe.lua")()
local Table = require("public.table")
GUI = require("gui.core")
local window = GUI.createWindow({
name = "My Script",
w = 296,
h = 248,
})
local layer = GUI.createLayer({ name = "My Layer" })
local button = GUI.createElement({
name = "Boo1",
type = "button",
x = 16,
y = 16,
caption = "Hi!"
})
local button2 = GUI.createElement({
name = "Boo2",
type = "button",
x = 46,
y = 46,
caption = "Hi!"
})
PUH=0
button.func = function()
PUH=PUH+1
end
layer:addElements(button)
layer:addElements(button2)
window:addLayers(layer)
|
|
|
06-08-2020, 08:09 PM
|
#717
|
Human being with feelings
Join Date: May 2020
Posts: 190
|
Has anyone ever adjusted the code for list-boxes so they return an entire list of bools when the list-box is set to multi? Right now it'll only return a partial list of what is selected rather than an entire indexed table of the table that I passed to it.
The idea is that it'll act like the return value for checklists where it gives you the bool for every indexed item in the list.
|
|
|
06-16-2020, 11:05 AM
|
#718
|
Human being with feelings
Join Date: Mar 2013
Posts: 5,857
|
Quote:
Originally Posted by Meo-Ada Mespotine
Thanks.
Another question: When I use this script and doubleclick one of the buttons, they stay "clicked". Is this intentional behavior as I doubleclicked at it or rather a bug?
I use Scythe in this example.
|
Unfortunately I haven't had time yet to take a deeper look at the differences in Scythe. So not sure if this behavior is intended.
I only had a quick look at the draw and click functions in the Button.lua files in V2 and V3 and at first glance both look very similar (so it doesn't look like there are any major changes there).
As example, the code for the double click function is the same in both versions (self.state = 0). And the same state is also set in the OnMouseUp function (triggered when releasing the mouse button).
Code:
function Button:onDoubleClick()
self.state = 0
end
The V3 wiki also only lists a left & right click function (and no double click function). So my first guess would be that this might perhaps be a bug.
Last edited by solger; 06-16-2020 at 11:36 AM.
|
|
|
06-16-2020, 11:25 AM
|
#719
|
Human being with feelings
Join Date: Mar 2013
Posts: 5,857
|
Quote:
Originally Posted by jkooks
Has anyone ever adjusted the code for list-boxes so they return an entire list of bools when the list-box is set to multi? ...
|
I guess it's possible by making a custom function in your script for creating and returning a 'full' selection table.
The 'partial' selection table is either passed as parameter to the custom function: - Get Listbox value (outside of custom function)
- Pass values as parameter to custom function
- Custom function creates and returns a 'full' selection table
Or everything is done inside the custom function: - Call custom function
- Get Listbox values (inside the custom function)
- Create and return a 'full' selection table
By the way: are you using v2 or v3 (Scythe) of the GUI library?
Quote:
Originally Posted by jkooks
... Right now it'll only return a partial list of what is selected rather than an entire indexed table of the table that I passed to it.
The idea is that it'll act like the return value for checklists where it gives you the bool for every indexed item in the list.
|
What's the use-case for which you require the 'full' listbox selection table?
Last edited by solger; 06-16-2020 at 10:08 PM.
|
|
|
06-16-2020, 12:28 PM
|
#720
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,630
|
Quote:
Originally Posted by solger
Unfortunately I haven't had time yet to take a deeper look at the differences in Scythe. So not sure if this behavior is intended.
I only had a quick look at the draw and click functions in the Button.lua files in V2 and V3 and at first glance both look very similar (so it doesn't look like there are any major changes there).
As example, the code for the double click function is the same in both versions (self.state = 0). And the same state is also set in the OnMouseUp function (triggered when releasing the mouse button).
Code:
function Button:onDoubleClick()
self.state = 0
end
The V3 wiki also only lists a left & right click function (and no double click function). So my first guess would be that this might perhaps be a bug.
|
Ok, so I probably need to debug this first. Otherwise clicked elements will not behave exactly as they do in all other dialogs of Reaper.
Double click would also be nice to have in general, so people can add their own classes who benefit from double-click.
|
|
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 11:17 PM.
|