Old 07-15-2018, 02:22 AM   #201
solger
Human being with feelings
 
solger's Avatar
 
Join Date: Mar 2013
Posts: 5,844
Default

I had some time to check the Listbox selection rectangle position issue mentioned in the ReaLauncher thread.
And it's the same here with the Example file. The y-position of the selection rectangle is sometimes off (usually when selecting items further down the list):



OSX 10.10.5 Yosemite
Reaper v5.92/64
Lokasenna GUI v2.11.3


Any ideas?


Let me know if you need any further info.
Attached Images
File Type: png listbox-example.png (50.7 KB, 3928 views)
solger is offline   Reply With Quote
Old 07-15-2018, 08:44 AM   #202
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

It would appear to be an OSX vs Windows issue, but beyond that I'm not sure. The math for where to draw the selection is pretty much the same as drawing the text.

My best guess is that the font height (gfx.texth) isn't being reported properly, as Listbox multiplies by that to find the y value for each line.

As a test, try fiddling with the font presets and see if it persists. Open Core.lua, find the table GUI.fonts, and change the fonts to something else, or try different sizes. I'm aware that the default, Calibri, isn't an OSX font, but AFAIK OSX just defaults back to Arial.

I've been meaning to make a font checking script; you type in a font, it draws some boxes with the reported size and whatnot so you can pinpoint issues like this.
__________________
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-15-2018 at 08:58 AM.
Lokasenna is offline   Reply With Quote
Old 07-15-2018, 08:53 AM   #203
solger
Human being with feelings
 
solger's Avatar
 
Join Date: Mar 2013
Posts: 5,844
Default

Quote:
Originally Posted by Lokasenna View Post
It would appear to be an OSX vs Windows issue, but beyond that I'm not sure.
Yeah, I don't have the issue here on Windows.

Quote:
As a test, try fiddling with the font presets and see if it persists. Open Core.lua, find the table GUI.fonts, and change the fonts to something else, or try different sizes. I'm aware that the default, Calibri, isn't an OSX font, but AFAIK OSX just defaults back to Arial.
OK. I'll investigate further ...
solger is offline   Reply With Quote
Old 07-17-2018, 06:35 AM   #204
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

Small update - added a .noclose parameter for Window elements to disable the X button and pressing Esc to close them. Handy for simple progress windows that you don't want users to get rid of.
__________________
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-17-2018, 03:26 PM   #205
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

Sort-of-but-not-update.

I'm abandoning my work on v3 for now - it's looking like a lot of rewriting to handle the structural changes I want to make, and I've got too much else going on. The upshot is that I've reverted the project repo to v2, and will continue picking away with bug fixes and smaller feature updates there.

ReaPack remains the home for stable releases. Any fixes will be added in both locations, and features will come over from the repo whenever I feel that they're trustworthy enough to not break anything.
__________________
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-17-2018, 04:43 PM   #206
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

Big update for the Developer Tools package...



It's a little rough, and probably broken in places I don't know about, but it's functional. Build a GUI, export it, etc. Instructions are in the Help menu.
__________________
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-17-2018, 04:57 PM   #207
_Stevie_
Human being with feelings
 
_Stevie_'s Avatar
 
Join Date: Oct 2017
Location: Black Forest
Posts: 5,054
Default

Holy moly! Impressive! Will definitely use that, if any of my scripts need a GUI.
__________________
My Reascripts forum thread | My Reascripts on GitHub
If you like or use my scripts, please support the Ukraine: Ukraine Crisis Relief Fund | DirectRelief | Save The Children | Razom
_Stevie_ is offline   Reply With Quote
Old 07-18-2018, 12:44 PM   #208
solger
Human being with feelings
 
solger's Avatar
 
Join Date: Mar 2013
Posts: 5,844
Default

Quote:
Big update for the Developer Tools package...
Very nice. Looks cool!
solger is offline   Reply With Quote
Old 07-18-2018, 11:13 PM   #209
MusoBob
Human being with feelings
 
MusoBob's Avatar
 
Join Date: Sep 2014
Posts: 2,643
Default

Awesome GUI Builder ! it was only a few months ago I ask you for one of them !

What you were saying about the Library path in Reaper/reaper-extstate.ini

Code:
lib_path_v2=[path to your user folder here]\REAPER\Scripts\ReaTeam Scripts\Development\Lokasenna_GUI v2\Library\

If I want to create the GUI script with a self contained Library rather than the common one, because if the Library is updated via ReaPack then the script may not work and give errors and need updating.

How do I change lib_path:
Code:
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 run 'Set Lokasenna_GUI v2 library path.lua' in the Lokasenna_GUI folder.", "Whoops!", 0)
    return
end
to use script_path
Code:
local info = debug.getinfo(1,'S');
script_path = info.source:match[[^@?(.*[\/])[^\/]-$]]
MusoBob is offline   Reply With Quote
Old 07-19-2018, 01:09 AM   #210
Thonex
Human being with feelings
 
Join Date: May 2018
Location: Los Angeles
Posts: 1,719
Default

Quote:
Originally Posted by Lokasenna View Post

It's a little rough, and probably broken in places I don't know about, but it's functional. Build a GUI, export it, etc. Instructions are in the Help menu.
Must.Resist.Temtation.And.Stay.Focused.On.Work.... arrggghg... this is killing me it's so awesome!

Nice one Loka!! One day I'm going to use this gem and your GUI Library!! Too good not to!

Cheers,

Andrew K
Thonex is offline   Reply With Quote
Old 07-19-2018, 03:41 AM   #211
_Stevie_
Human being with feelings
 
_Stevie_'s Avatar
 
Join Date: Oct 2017
Location: Black Forest
Posts: 5,054
Default

@Andrew

Reaper and its surroundings are a permanent temptation to learn something new. It's hard and really keeps me off from working!
__________________
My Reascripts forum thread | My Reascripts on GitHub
If you like or use my scripts, please support the Ukraine: Ukraine Crisis Relief Fund | DirectRelief | Save The Children | Razom
_Stevie_ is offline   Reply With Quote
Old 07-19-2018, 04:40 AM   #212
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

Quote:
Originally Posted by MusoBob View Post
Awesome GUI Builder ! it was only a few months ago I ask you for one of them !
And I believe I told you "probably next week".

Quote:
If I want to create the GUI script with a self contained Library rather than the common one, because if the Library is updated via ReaPack then the script may not work and give errors and need updating.
The ReaPack release is very, VERY specifically intended to be the stable version. Only bug fixes. Any feature updates will go through the project repo first and ideally stay there for a while until I'm confident they're safe.

Quote:
How do I change lib_path:
Code:
local lib_path = reaper.GetExtState("Lokasenna_GUI", "lib_path_v2")
to use script_path
Code:
local info = debug.getinfo(1,'S');
script_path = info.source:match[[^@?(.*[\/])[^\/]-$]]
Again, don't. I put it on ReaPack because I hate having to distribute the library for each script, and if other people are doing it too there's no way for me to fix any bugs that pop up.

However, if you really have to:
Code:
local script_path, script_name = ({reaper.get_action_context()})[2]:match("(.-)([^/\\]+).lua$")
__________________
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-2018, 03:17 AM   #213
tompad
Human being with feelings
 
Join Date: Jan 2010
Location: Fjugesta, Sweden
Posts: 811
Default

Quote:
Originally Posted by Lokasenna View Post
Big update for the Developer Tools package...

It's a little rough, and probably broken in places I don't know about, but it's functional. Build a GUI, export it, etc. Instructions are in the Help menu.
Oh my..........! How do I run this?

Edit:
Tried to load and run GUI Builder-script but gets Library error:
"Couldn't load /home/tompad/.config/Reaper/Scripts/ReaTeam Scripts/Development/Lokasenn_GUI v2/Developer Tools/GUI Builder/modules/func_Elements.lua"

and then there is a line with:
Error: cannot open /home/tompad/.config/Reaper/Scripts/ReaTeam Scripts/Development/Lokasenn_GUI v2/Library//home/tompad/.config/Reaper/Scripts/ReaTeam Scripts/Development/Lokasenn_GUI v2/Developer Tools/GUI Builder.....and then the rest of the path is not visible, cant resize window, cant copy text....can just click OK-button.

Strange with the double // in middle of the error-path...

Maybe its because I am on Reaper Linux 5.93??
__________________
ToDoList Obliques MusicMath Donation Some of mine and my friends music projects on Spotify

Last edited by tompad; 07-23-2018 at 04:14 AM.
tompad is offline   Reply With Quote
Old 07-23-2018, 04:36 AM   #214
MusoBob
Human being with feelings
 
MusoBob's Avatar
 
Join Date: Sep 2014
Posts: 2,643
Default

You need to run *Set Lokasenna_GUI v2 library path.lua
it will write the library location in REAPER\reaper-extstate.ini

Code:
[Lokasenna_GUI]
lib_path_v2=C:\Users\User\AppData\Roaming\REAPER\Scripts\ReaTeam Scripts\Development\Lokasenna_GUI v2\Library\
you can add the path manually in a format for Linux.

Last edited by MusoBob; 07-23-2018 at 03:13 PM.
MusoBob is offline   Reply With Quote
Old 07-23-2018, 05:46 AM   #215
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

My first guess would be a Linux issue, or at least an issue with my script being incompatible with something on Linux, but I wouldn't put it past myself to have simply screwed something up.

1. Did you install with ReaPack, or manually?

2. Did you type the path out for your post or copy/paste it? I noticed /Lokasenn_GUI v2/, which isn't a typo in any of the files on my 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
Old 07-23-2018, 06:36 AM   #216
tompad
Human being with feelings
 
Join Date: Jan 2010
Location: Fjugesta, Sweden
Posts: 811
Default

Quote:
Originally Posted by MusoBob View Post
You need to run Lokasenna_GUI library v2.lua
it will write the library location in REAPER\reaper-extstate.ini

Code:
[Lokasenna_GUI]
lib_path_v2=C:\Users\User\AppData\Roaming\REAPER\Scripts\ReaTeam Scripts\Development\Lokasenna_GUI v2\Library\
you can add the path manually in a format for Linux.
Its already done....
Checked .ini and path was there.
__________________
ToDoList Obliques MusicMath Donation Some of mine and my friends music projects on Spotify
tompad is offline   Reply With Quote
Old 07-23-2018, 06:39 AM   #217
tompad
Human being with feelings
 
Join Date: Jan 2010
Location: Fjugesta, Sweden
Posts: 811
Default

Quote:
Originally Posted by Lokasenna View Post
My first guess would be a Linux issue, or at least an issue with my script being incompatible with something on Linux, but I wouldn't put it past myself to have simply screwed something up.

1. Did you install with ReaPack, or manually?

2. Did you type the path out for your post or copy/paste it? I noticed /Lokasenn_GUI v2/, which isn't a typo in any of the files on my end.
1. With ReaPack.

2. I typed it - its a typo from my side sorry. But the double // is not.
__________________
ToDoList Obliques MusicMath Donation Some of mine and my friends music projects on Spotify
tompad is offline   Reply With Quote
Old 07-23-2018, 06:45 AM   #218
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

- Are both of the GUI packages up to date? I did mess up the Library briefly a few days ago and none of the element classes were being included. Try Extensions > ReaPack > Synchronize Packages.

- Are GUI Builder's files there? In /Reaper/Scripts/ReaTeam Scripts/Development/Lokasenna_GUI v2/Developer Tools/GUI Builder/modules/, there should be 12 scripts.

- Do the Example scripts in the Dev. Tools package work? That would help us figure out if it's a GUI Builder issue or the Library itself.
__________________
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-2018, 06:51 AM   #219
tompad
Human being with feelings
 
Join Date: Jan 2010
Location: Fjugesta, Sweden
Posts: 811
Default

Updated to 2.14.1 on both Linux and Windows.

Working in Windows - got error in Linux.

This is the errorlog:

Code:
Error: Couldn't get error message.

cannot open /home/tompad/.config/REAPER/Scripts/ReaTeam Scripts/Development/Lokasenna_GUI v2/Library//home/tompad/.config/REAPER/Scripts/ReaTeam Scripts/Development/Lokasenna_GUI v2/Developer Tools/GUI Builder/modules/func_Elements.lua: No such file or directory

Stack traceback:
	Core.lua:70: in field 'crash'
	Core.lua:131: in field 'req'
	Lokasenna_GUI Builder.lua:51: in main chunk

Lokasenna_GUI:	v2.14.1
Reaper:       	5.93/linux64
Platform:     	Other
__________________
ToDoList Obliques MusicMath Donation Some of mine and my friends music projects on Spotify
tompad is offline   Reply With Quote
Old 07-23-2018, 06:59 AM   #220
tompad
Human being with feelings
 
Join Date: Jan 2010
Location: Fjugesta, Sweden
Posts: 811
Default

Quote:
Originally Posted by Lokasenna View Post
- Are both of the GUI packages up to date? I did mess up the Library briefly a few days ago and none of the element classes were being included. Try Extensions > ReaPack > Synchronize Packages.

- Are GUI Builder's files there? In /Reaper/Scripts/ReaTeam Scripts/Development/Lokasenna_GUI v2/Developer Tools/GUI Builder/modules/, there should be 12 scripts.

- Do the Example scripts in the Dev. Tools package work? That would help us figure out if it's a GUI Builder issue or the Library itself.
I run Synchronize.

Yes 12 files in /modules/

I tested Example - General demonstration and it works
__________________
ToDoList Obliques MusicMath Donation Some of mine and my friends music projects on Spotify
tompad is offline   Reply With Quote
Old 07-23-2018, 07:14 AM   #221
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

Aha, I know what it is.

My code for loading external files uses ":" to tell if it's being given a relative path or an absolute one (C:\Games\...), since I'm a Windows guy. Mac and Linux don't, but until now it hasn't been a problem.

If you aren't averse to some basic script editing:

- Find and open ReaTeam Scripts/Development/Lokasenna_GUI v2/Library/Core.lua in a text editor.

- Scroll down to (should be) line 115, which looks like this:
Code:
        local ret, err = loadfile(( file:sub(2, 2) == ":" and "" or GUI.lib_path ) .. file)
- Replace it with this:
Code:
        local ret, err = loadfile(( (file:sub(2, 2) == ":" or file:sub(1, 1) == "/") and "" or GUI.lib_path ) .. file)
- Save the file, making sure it keeps the .lua extension, and try running GUI Builder again.

If that works I'll push the fix up to ReaPack.
__________________
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-2018, 08:09 AM   #222
tompad
Human being with feelings
 
Join Date: Jan 2010
Location: Fjugesta, Sweden
Posts: 811
Default

Quote:
Originally Posted by Lokasenna View Post
Aha, I know what it is.

My code for loading external files uses ":" to tell if it's being given a relative path or an absolute one (C:\Games\...), since I'm a Windows guy. Mac and Linux don't, but until now it hasn't been a problem.

If you aren't averse to some basic script editing:

- Find and open ReaTeam Scripts/Development/Lokasenna_GUI v2/Library/Core.lua in a text editor.

- Scroll down to (should be) line 115, which looks like this:
Code:
        local ret, err = loadfile(( file:sub(2, 2) == ":" and "" or GUI.lib_path ) .. file)
- Replace it with this:
Code:
        local ret, err = loadfile(( (file:sub(2, 2) == ":" or file:sub(1, 1) == "/") and "" or GUI.lib_path ) .. file)
- Save the file, making sure it keeps the .lua extension, and try running GUI Builder again.

If that works I'll push the fix up to ReaPack.

Hiayaaaaaa! I'm the codeknocker! Swisch!

It works!

Damn - this will be soooooo fun to make use of! Thanks Lokasenna!


Is this maybe a solution connected to "Open Lokasenna GUI Development Tools Folder"? Nothing happens when running that script.

---oops, I took a look in the script and found some reg expr....uuuaa, down to earth again, have never understood reg expr!
__________________
ToDoList Obliques MusicMath Donation Some of mine and my friends music projects on Spotify
tompad is offline   Reply With Quote
Old 07-23-2018, 09:22 AM   #223
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

Awesome, pushing an update for both of those now.

The issue with "Open Dev. Tools folder" was just that it checked for OSX and then assumed Windows as a default, but Windows commands don't work on Linux. I've rearranged the logic to check for Windows and then use the OSX command otherwise, which AFAIK is the same on Linux.

The RegEx you're seeing isn't technically a RegEx, since Lua doesn't use them. Most of the time it works the same, but there are a few different/extra/missing features in Lua's version (called "patterns").

That pattern just takes the file path of the script and splits it into a path and name, dropping the .lua. In this case the script only cares about the path.
Code:
"(.-)([^/\\]+).lua$"
- ()s mark values we want to pick out, called "captures".

- . will match any character, with - telling it to capture as few characters as possible while still matching the rest of the pattern. In this case, that will end up being everything prior to the last / - the path.

- The next capture is a set, denoted by [], that matching that isn't (^) a / or \. The latter has to be doubled because patterns and RegExes both use single backslashes to mark special characters. \t is Tab, for instance, and \\ is the special character for "yes, I really mean a backslash".

- The + tells it to match at least one character of that set, but as many characters as possible while still matching the rest of the pattern. This is captured and returned as the script name.

- .lua$ is the extension, obviously, and a marker specifying that must be at the end of the string. Theoretically you could have a .lua somewhere in the middle of the path and, without that, it would match 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 07-23-2018, 10:45 AM   #224
D Rocks
Human being with feelings
 
Join Date: Dec 2017
Location: Quebec, Canada
Posts: 550
Default

Wow.. this is awesome stuff man seriously. You will save tons of times to many future developpement. It looks great too in my opinion its not only handy.
__________________
Alex | www.drocksrecords.com | Thanks for REAPER
D Rocks is offline   Reply With Quote
Old 07-23-2018, 01:28 PM   #225
tompad
Human being with feelings
 
Join Date: Jan 2010
Location: Fjugesta, Sweden
Posts: 811
Default

Quote:
Originally Posted by Lokasenna View Post
Awesome, pushing an update for both of those now.

The issue with "Open Dev. Tools folder" was just that it checked for OSX and then assumed Windows as a default, but Windows commands don't work on Linux. I've rearranged the logic to check for Windows and then use the OSX command otherwise, which AFAIK is the same on Linux.

The RegEx you're seeing isn't technically a RegEx, since Lua doesn't use them. Most of the time it works the same, but there are a few different/extra/missing features in Lua's version (called "patterns").

That pattern just takes the file path of the script and splits it into a path and name, dropping the .lua. In this case the script only cares about the path.
Code:
"(.-)([^/\\]+).lua$"
- ()s mark values we want to pick out, called "captures".

- . will match any character, with - telling it to capture as few characters as possible while still matching the rest of the pattern. In this case, that will end up being everything prior to the last / - the path.

- The next capture is a set, denoted by [], that matching that isn't (^) a / or \. The latter has to be doubled because patterns and RegExes both use single backslashes to mark special characters. \t is Tab, for instance, and \\ is the special character for "yes, I really mean a backslash".

- The + tells it to match at least one character of that set, but as many characters as possible while still matching the rest of the pattern. This is captured and returned as the script name.

- .lua$ is the extension, obviously, and a marker specifying that must be at the end of the string. Theoretically you could have a .lua somewhere in the middle of the path and, without that, it would match there.
Great! Will Synchronize again.

Thanks for the explaination of ... well, I will need to read this a LOT of times before I fully understand it. Patterns and captures - hmmmmm....
now I read it 4 times and start to see some sort of....logic? Oh no, there it disapeared again... will try again tomorrow - now I need sleep.
__________________
ToDoList Obliques MusicMath Donation Some of mine and my friends music projects on Spotify
tompad is offline   Reply With Quote
Old 07-23-2018, 01:52 PM   #226
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

Roblox has a great pattern tutorial. But the page is gone. Thankfully we have Google...

https://webcache.googleusercontent.c...&ct=clnk&gl=ca

Here's the RegEx equivalent of the pattern above: https://regex101.com/r/7oMb6M/1/. I really wish there was a Lua version of that page, but once you've done it a little the differences aren't hard to work around. Holy hell is it useful, though - particularly in NP++ or VS Code if you need to find and replace something complicated.
__________________
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-23-2018 at 02:00 PM.
Lokasenna is offline   Reply With Quote
Old 07-23-2018, 02:00 PM   #227
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,875
Default

@lokasenna


This is the non cached version of the Roblox Doc String Patterns:

http://robloxdev.com/articles/string-patterns-reference
X-Raym is offline   Reply With Quote
Old 07-23-2018, 02:02 PM   #228
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

Thank you - updating my bookmark. Google still sends you to the old URL.
__________________
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-24-2018, 04:52 AM   #229
tompad
Human being with feelings
 
Join Date: Jan 2010
Location: Fjugesta, Sweden
Posts: 811
Default

Quote:
Originally Posted by Lokasenna View Post
Roblox has a great pattern tutorial. But the page is gone. Thankfully we have Google...

https://webcache.googleusercontent.c...&ct=clnk&gl=ca

Here's the RegEx equivalent of the pattern above: https://regex101.com/r/7oMb6M/1/. I really wish there was a Lua version of that page, but once you've done it a little the differences aren't hard to work around. Holy hell is it useful, though - particularly in NP++ or VS Code if you need to find and replace something complicated.
Thanks! Can come handy, definitly help me understand.
__________________
ToDoList Obliques MusicMath Donation Some of mine and my friends music projects on Spotify
tompad is offline   Reply With Quote
Old 07-24-2018, 04:53 AM   #230
tompad
Human being with feelings
 
Join Date: Jan 2010
Location: Fjugesta, Sweden
Posts: 811
Default

Quote:
Originally Posted by X-Raym View Post
@lokasenna


This is the non cached version of the Roblox Doc String Patterns:

http://robloxdev.com/articles/string-patterns-reference
Nice! Thanks X-Raym!
__________________
ToDoList Obliques MusicMath Donation Some of mine and my friends music projects on Spotify
tompad is offline   Reply With Quote
Old 07-24-2018, 06:15 AM   #231
tompad
Human being with feelings
 
Join Date: Jan 2010
Location: Fjugesta, Sweden
Posts: 811
Default

@Lokasenna

GUI-builder is great - but how do I delete a selected item?

Edit: And how to load a already exported GUI? I had a crasch
of GUI-Builder and was not finished with the GUI.

Crash report:
Error: tab_Properties.lua:187: attempt to call a nil value (field 'init_properties')

Stack traceback:
Core.lua:70: in field 'init_properties'
tab_Properties.lua:187: in method 'onmouseup'
Core.lua:854: in field 'Update'
Core.lua:413: in field 'Main_Update_Elms'
Core.lua:280: in function <...am Scripts/Development/Lokasenna_GUI v2/Library/Core.lua:276>
[C]: in function 'xpcall'
Core.lua:276: in function <...am Scripts/Development/Lokasenna_GUI v2/Library/Core.lua:275>

Lokasenna_GUI: v2.14.1
Reaper: 5.93/linux64
Platform: Other

This is a crasch report I made after the second crasch (just two buttons and a textbox)
__________________
ToDoList Obliques MusicMath Donation Some of mine and my friends music projects on Spotify

Last edited by tompad; 07-24-2018 at 06:20 AM.
tompad is offline   Reply With Quote
Old 07-24-2018, 08:36 AM   #232
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

- Alt+click to delete. Adding that to the Help screen now.

- There's currently no load/import functionality, but it's the next thing on my to-do list. Sorry.

- Crash fixed, updating now. Cheers, and thanks for actually using the crash report. Everyone seems to ignore 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 07-24-2018, 08:59 AM   #233
tompad
Human being with feelings
 
Join Date: Jan 2010
Location: Fjugesta, Sweden
Posts: 811
Default

Quote:
Originally Posted by Lokasenna View Post
- Alt+click to delete. Adding that to the Help screen now.
Thought I tested all combinations - apparently not ;-)

Quote:
- There's currently no load/import functionality, but it's the next thing on my to-do list. Sorry.
No problema - sometimes having a wip over your head is a good thing,
now I MUST finish making the GUI ;-)

Quote:
- Crash fixed, updating now. Cheers, and thanks for actually using the crash report. Everyone seems to ignore it.
[singing]Keep smiling, keep shining
Knowing you can always count on me, for sure
That's what crash report are for
For good times and bad times....[/singing]

All Rights by Burt himself I belive.
__________________
ToDoList Obliques MusicMath Donation Some of mine and my friends music projects on Spotify
tompad is offline   Reply With Quote
Old 07-25-2018, 03:54 AM   #234
tompad
Human being with feelings
 
Join Date: Jan 2010
Location: Fjugesta, Sweden
Posts: 811
Default

Quote:
Originally Posted by Lokasenna View Post
- Alt+click to delete. Adding that to the Help screen now.
Just discovered -in Linux = ctrl + Alt + click to delete.
__________________
ToDoList Obliques MusicMath Donation Some of mine and my friends music projects on Spotify
tompad is offline   Reply With Quote
Old 07-25-2018, 04:14 AM   #235
tompad
Human being with feelings
 
Join Date: Jan 2010
Location: Fjugesta, Sweden
Posts: 811
Default

@Lokasenna

Have been playing with GUI Builder, working good, and started to test
to get some functionality in button clicks. After some attempts doing
it my self I gave up and started copy-paste from one of yours exemples
(Example - Typical script options.lua) but cant get it to run.
The example it self is running good but not the copy in my script.
Have double checked so there were no typos..

Get a crash everytime I run it:

Code:
Error: Class - Button.lua:62: attempt to perform arithmetic on a nil value (field 'w')

Stack traceback:
	Core.lua:70: in metamethod '__mul'
	Class - Button.lua:62: in method 'init'
	Core.lua:193: in field 'update_elms_list'
	Core.lua:266: in function <...am Scripts/Development/Lokasenna_GUI v2/Library/Core.lua:212>
		[C]: in function 'xpcall'
	Core.lua:212: in field 'Init'
	DLT_ToDoList.lua:248: in main chunk

Lokasenna_GUI:	v2.14.1
Reaper:       	5.93/linux64
Platform:     	Other
Is it a Linux-thing?

My code is:
Code:
-- The Core library must be loaded prior to anything else

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 run 'Script: Set Lokasenna_GUI v2 library path.lua' in your Action List.", "Whoops!", 0)
    return
end
loadfile(lib_path .. "Core.lua")()

GUI.req("Classes/Class - Button.lua")()
GUI.req("Classes/Class - Listbox.lua")()

-- If any of the requested libraries weren't found, abort the script nicely.
if missing_lib then return 0 end


------------------------------------
-------- Functions  ----------------
------------------------------------

local function btn_click()

	-- Be nice, give the user an Undo point
	reaper.Undo_BeginBlock()
	msg("Hi!")
	reaper.Undo_EndBlock("Typical script options", 0)

	-- Exit the script on the next update
	GUI.quit = true

end

local function msg(m)
  --reaper.ClearConsole()
  reaper.ShowConsoleMsg(tostring(m) .. "\n")
end

------------------------------------
-------- Window settings -----------
------------------------------------

GUI.name = "New script GUI"
GUI.x, GUI.y, GUI.w, GUI.h = 0, 0, 640, 480
GUI.anchor, GUI.corner = "mouse", "C"

------------------------------------
-------- GUI Elements --------------
------------------------------------

GUI.New("Button1", "Button", {
    z = 11,
    x = 96,
    y = 160,
    w = 48,
    h = 24,
    caption = "Remove",
    font = 3,
    col_txt = "txt",
    col_fill = "elm_frame"
},btn_click)

GUI.New("Listbox1", "Listbox", {
    z = 11,
    x = 16,
    y = 16,
    w = 192,
    h = 96,
    list = {"+New", "Item 2", "Item 3", "Item 4"},
    multi = false,
    caption = "",
    font_a = 3,
    font_b = 4,
    color = "txt",
    col_fill = "elm_fill",
    bg = "elm_bg",
    cap_bg = "wnd_bg",
    shadow = true,
    pad = 4
})

GUI.Init()
GUI.Main()
Bug or have I missed something?
__________________
ToDoList Obliques MusicMath Donation Some of mine and my friends music projects on Spotify
tompad is offline   Reply With Quote
Old 07-25-2018, 07:21 AM   #236
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

Not sure why it would cause a crash where you're seeing it, but when creating the button you've got btn_click outside the element table:
Code:
GUI.New("Button1", "Button", {
    z = 11,
    x = 96,
    y = 160,
    w = 48,
    h = 24,
    caption = "Remove",
    font = 3,
    col_txt = "txt",
    col_fill = "elm_frame"
},btn_click)
This works:
Code:
GUI.New("Button1", "Button", {
    z = 11,
    x = 96,
    y = 160,
    w = 48,
    h = 24,
    caption = "Remove",
    font = 3,
    col_txt = "txt",
    col_fill = "elm_frame",
    func = btn_click
})
When using a table for your elements (which is proving to be way easier in a number of ways), all of the parameters have to be in the table and have their appropriate key.
__________________
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-25-2018, 08:29 AM   #237
tompad
Human being with feelings
 
Join Date: Jan 2010
Location: Fjugesta, Sweden
Posts: 811
Default

Quote:
Originally Posted by Lokasenna View Post
When using a table for your elements (which is proving to be way easier in a number of ways), all of the parameters have to be in the table and have their appropriate key.
Ahaa, ok, got it! Great, thank you!
__________________
ToDoList Obliques MusicMath Donation Some of mine and my friends music projects on Spotify
tompad is offline   Reply With Quote
Old 08-02-2018, 04:26 AM   #238
tompad
Human being with feelings
 
Join Date: Jan 2010
Location: Fjugesta, Sweden
Posts: 811
Default Dropdown meny without an element?

Hi!

Is this possible to do with Lokasenna GUI library?

I want a dropdown to show up when I right click on an item
in a listbox. I have figured out the right click function,
but how do I get a dropdown? I dont want a box just the
dropdown menu.

Edit: Found out that the answer is YES - GUI Builder have
one dropdown for the elements. But looking in code....I dont
understand how this dropdown works, I am lost! Help is needed.
__________________
ToDoList Obliques MusicMath Donation Some of mine and my friends music projects on Spotify

Last edited by tompad; 08-02-2018 at 05:24 AM.
tompad is offline   Reply With Quote
Old 08-02-2018, 07:23 AM   #239
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

Code:
gfx.showmenu("str")
Shows a popup menu at gfx.x,gfx.y. str is a list of fields separated by | characters. Each field represents a menu item.
Fields can start with special characters:

# : grayed out
! : checked
> : this menu item shows a submenu
< : last item in the current submenu

An empty field will appear as a separator in the menu. gfx.showmenu returns 0 if the user selected nothing from the menu, 1 if the first field is selected, etc.
Example:

gfx.showmenu("first item, followed by separator||!second item, checked|>third item which spawns a submenu|#first item in submenu, grayed out|<second and last item in submenu|fourth item in top menu")
__________________
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 08-02-2018, 08:32 AM   #240
tompad
Human being with feelings
 
Join Date: Jan 2010
Location: Fjugesta, Sweden
Posts: 811
Default

Quote:
Originally Posted by Lokasenna View Post
Code:
gfx.showmenu("str")
Shows a popup menu at gfx.x,gfx.y. str is a list of fields separated by | characters. Each field represents a menu item.
Fields can start with special characters:

# : grayed out
! : checked
> : this menu item shows a submenu
< : last item in the current submenu

An empty field will appear as a separator in the menu. gfx.showmenu returns 0 if the user selected nothing from the menu, 1 if the first field is selected, etc.
Example:

gfx.showmenu("first item, followed by separator||!second item, checked|>third item which spawns a submenu|#first item in submenu, grayed out|<second and last item in submenu|fourth item in top menu")
Lovely! And I just found out about gfx.mouse_x, gfx.mouse_y!! So now
it is placed properly! Thanks!


Edit: Oooh and now I found out where to find this information - Reaper API - the Holy Grail! Didn't know gfx was in it....
__________________
ToDoList Obliques MusicMath Donation Some of mine and my friends music projects on Spotify

Last edited by tompad; 08-03-2018 at 07:56 AM.
tompad 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 12:07 PM.


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