Old 12-18-2019, 04:23 AM   #641
tompad
Human being with feelings
 
Join Date: Jan 2010
Location: Fjugesta, Sweden
Posts: 811
Default Lokasenna GUI v2 - how to make a progressbar with slider

Hi there all LGUIv2-users!

I am trying to make a progress bar of a slider for my Practice Coach-script
and I have sort of managed to do it BUT there is one issue. When I start
script everything is correct - slider starts in zero position and is rising
to max position and when max is reached the slider resets to zero. And now
ladies and gentlemens the problem arise! Next time the loop is run the slider
starts at a minus-position outside of the slider! I cant figure out where the
negative numbers come from....

Code:
GUI.New("Slider1", "Slider", {
  z = 11,
  x = 8,
  y = 8,
  w = 200,
  caption = "",
  min = 10,
  max =0,
  defaults = {0},
  inc = 1,
  dir = "v",
  font_a = 3,
  font_b = 4,
  col_txt = "txt",
  col_fill = "elm_fill",
  bg = "wnd_bg",
  show_handles = false,
  show_values = false,
  cap_x = 0,
  cap_y = 0
})


--other code.......


function startButton ()
  if buttonEnabled then
    startTime = reaper.time_precise()
    endTime = startTime + practiceTime[i]
    setBPM()
    countDownTimer()
    GUI.elms.Start_Cont_Button.caption = "...."
    reaper.Main_OnCommandEx( 40630, 0, 0 )
    reaper.OnPlayButton()
    buttonEnabled = false
    i = i + 1
    stepsLeft = stepsLeft - 1
    GUI.Val("StepsLeft_Label", "Steps left: " .. stepsLeft)
  else
    --...nothing should happen - button is disabled
  end
end


function countDownTimer()
  if (reaper.time_precise() <= endTime) then
    reaper.defer(countDownTimer)
    progress = (endTime - reaper.time_precise())
    GUI.Val("Slider1", progress )
  else
    reaper.OnStopButton()
    GUI.Val("Slider1", 10 )
    buttonEnabled = true
    if i <= 8 then
      notFinished = true
      GUI.elms.Start_Cont_Button.caption = "Continue"
      GUI.elms.Start_Cont_Button:redraw()
    else
      notFinished = false
      GUI.elms.Start_Cont_Button.caption = "Start"
      GUI.elms.Start_Cont_Button:redraw()
      stepsLeft = 8
      GUI.Val("StepsLeft_Label", "Steps left: " .. stepsLeft)
      i = 1
    end
    if autoContinue and notFinished then
      autoContMB = GUI.Val("AutoContMB")
      pauseTime = autoContMB * 5
      startTime2 = endTime
      endTime2 = startTime2 + pauseTime
      countDownTimer2()
    end
  end
end

function countDownTimer2 ()
  if (reaper.time_precise() <= endTime2) then
    reaper.defer(countDownTimer2)
  else
    startButton()
  end
end
I am testing this on my developer computer with Linux and the latest LGUIv2 and Reaper 6.0.

I am not sure my solution is the best one - if you have another approach
to a progressbar with LGUIv2 I love to hear from you!

Regards
Thomas
__________________
ToDoList Obliques MusicMath Donation Some of mine and my friends music projects on Spotify
tompad is offline   Reply With Quote
Old 12-18-2019, 04:48 AM   #642
reapero
Human being with feelings
 
Join Date: Aug 2011
Posts: 517
Default

Thanks again!

I have found another problem with this approach. Would like your opinion please. Everytime a user selects a preset, the UI changes reflecting each slider, button values. Good.

Because the menubox preset selector is inside the main loop, everytime i try to change a parameter after loading a preset the UI automatically updates to the preset data, reading it from the Extsate and applying it to the elemetns continuously...which makes it impossible to edit any preset XD

So, if i want to keep it simple with just the menubox, is there a way to call a function from the loop but only once? Ideally updating the GUI with the preset data should happen only when the menubox selector changes, not on every loop.

This is probably a basic loop misunderstanding so excuse me if the answer is too obvious. :blush:
reapero is offline   Reply With Quote
Old 12-18-2019, 09:49 AM   #643
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

Quote:
Originally Posted by tompad View Post
Hi there all LGUIv2-users!

I am trying to make a progress bar of a slider for my Practice Coach-script
and I have sort of managed to do it BUT there is one issue. When I start
script everything is correct - slider starts in zero position and is rising
to max position and when max is reached the slider resets to zero. And now
ladies and gentlemens the problem arise! Next time the loop is run the slider
starts at a minus-position outside of the slider! I cant figure out where the
negative numbers come from....
Can't say for sure without the rest of the code, but my guess would be this:
Code:
progress = (endTime - reaper.time_precise())
GUI.Val("Slider1", progress )
The Slider's val method expects a multiple of [i]inc/i] within its range - 0 to 10, in this case. I'm not sure what happens if you give it something like 5.125, but even assuming it does the right thing there you're still passing in the time difference rather than a value from 0 to 10. Try:
Code:
    local progress = endTime - reaper.time_precise()
    local length = endTime - startTime
    local progress = math.floor(progress / length * GUI.elms.Slider1.steps)
    GUI.Val("Slider1", progress )
Quote:
I am not sure my solution is the best one - if you have another approach to a progressbar with LGUIv2 I love to hear from you!
You could simplify things by just using a Frame and overriding its draw method to draw a progress bar using a percentage of its full width. Then you wouldn't have to worry about slider steps, range, etc.
__________________
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 12-18-2019, 09:58 AM   #644
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

Quote:
Originally Posted by reapero View Post
Because the menubox preset selector is inside the main loop
I'm confused; why is the preset selector in your main loop? You should just have to attach your handler to the menubox so it's run every time the user chooses a preset. Something like:
Code:
local function updateOtherElements()
  ...
end

function GUI.elms.myMenuBox:onmouseup()
  GUI.Menubox.onmouseup(self)

  updateOtherElements()
end

function GUI.elms.myMenuBox.onmouseup()
  GUI.Menubox.onwheel(self)

  updateOtherElements()
end
Quote:
So, if i want to keep it simple with just the menubox, is there a way to call a function from the loop but only once? Ideally updating the GUI with the preset data should happen only when the menubox selector changes, not on every loop.
If you do need to have it in the main loop, for whatever reason, then something like this will do the trick:
Code:
local presetWasChanged = false

function GUI.elms.myMenuBox:onmouseup()
  GUI.Menubox.onmouseup(self)
  presetWasChanged = true
end

function GUI.elms.myMenuBox.onmouseup()
  GUI.Menubox.onwheel(self)
  presetWasChanged = true
end

local function mainLoop()
  if presetWasChanged then
    -- Update the other elements
    presetWasChanged = false
  else
    -- Do something else
  end

  reaper.defer(mainLoop)
end

mainLoop()
__________________
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 12-18-2019, 10:17 AM   #645
reapero
Human being with feelings
 
Join Date: Aug 2011
Posts: 517
Default

Quote:
Originally Posted by Lokasenna View Post
I'm confused; why is the preset selector in your main loop? You should just have to attach your handler to the menubox so it's run every time the user chooses a preset. Something like:
[code]local function updateOtherElements()
...
Allright, i completely did it wrong then. I didnt connect any onmouseup() to anything and since i only got a static value from the menubox (the one when the script initializes) i thought the way to get it was to put it inside the main loop.

I think i got confused by not seeing those methods in the wiki subpage for the menubox class:

https://github.com/jalovatt/Lokasenna_GUI/wiki/2.00-Menubox

I guess those are inherited from other classes. Would adding this info there make sense or is it just common sense i failed to understand? Maybe its already explained somewhere?

Thanks!
reapero is offline   Reply With Quote
Old 12-18-2019, 10:27 AM   #646
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

They aren't covered in the documentation, no. Have a look at Example - Adding a Main loop, working with Z layers, and Rewriting Methods.lua for a very similar use case to what you're doing though.

v3 will make them much easier and I'll be sure to actually document them this time
__________________
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 12-18-2019, 10:39 AM   #647
reapero
Human being with feelings
 
Join Date: Aug 2011
Posts: 517
Default

Sure. Looking forward to it!
reapero is offline   Reply With Quote
Old 12-20-2019, 04:53 AM   #648
reapero
Human being with feelings
 
Join Date: Aug 2011
Posts: 517
Default

I cant set a checkbox to false using:

Code:
GUI.Val("My_checkbox",false)
Setting it to true works though. Bug maybe?
reapero is offline   Reply With Quote
Old 12-20-2019, 09:50 AM   #649
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

What version of the library are you using? It is a bug, but one that I added a fix for a month ago. (v2.16.10)

Here's the code; it's entirely possible I made a logic error:
Code:
  if newval ~= nil then
    if type(newval) == "table" then
      for k, v in pairs(newval) do
        self.optsel[tonumber(k)] = v
      end
      self:redraw()
    elseif type(newval) == "boolean" and #self.optarray == 1 then
      self.optsel[1] = newval
      self:redraw()
    end
  else
  ...
__________________
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 12-20-2019, 02:50 PM   #650
Buy One
Human being with feelings
 
Buy One's Avatar
 
Join Date: Sep 2019
Posts: 1,134
Default

Through ReaTrak i finally have discovered the possibility of making custom toolbars and drop-down menus with this great Lokasenna's library.

My question is if there's a way to define in the code line breaks for menu items with long names.
Buy One is offline   Reply With Quote
Old 12-20-2019, 03:01 PM   #651
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

Nope. Reaper uses native popup menus on Mac and Windows, and a pretend-native one on Linux, and none of those allow multiline items as far as I've ever seen.

In other news, v3 of the library will add a module specifically for making dealing with menus less of a hassle; no more parsing the string yourself, filtering out separators, etc.
__________________
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 12-20-2019, 03:06 PM   #652
Buy One
Human being with feelings
 
Buy One's Avatar
 
Join Date: Sep 2019
Posts: 1,134
Default

I see, thank you
Buy One is offline   Reply With Quote
Old 12-22-2019, 02:42 AM   #653
tompad
Human being with feelings
 
Join Date: Jan 2010
Location: Fjugesta, Sweden
Posts: 811
Default

Quote:
Originally Posted by Lokasenna View Post
The Slider's val method expects a multiple of [i]inc/i] within its range - 0 to 10, in this case. I'm not sure what happens if you give it something like 5.125, but even assuming it does the right thing there you're still passing in the time difference rather than a value from 0 to 10. Try:
Code:
    local progress = endTime - reaper.time_precise()
    local length = endTime - startTime
    local progress = math.floor(progress / length * GUI.elms.Slider1.steps)
    GUI.Val("Slider1", progress )
Absolutly brilliant!! That did it!

Quote:
You could simplify things by just using a Frame and overriding its draw method to draw a progress bar using a percentage of its full width. Then you wouldn't have to worry about slider steps, range, etc.
I looked a bit on Frame but found that Slider looked better so Slider it be :-)

Thanks Lokasenna! Excellent solutions as always.
I wish you a Merry Christmas and a Happy New Year! Salut!
__________________
ToDoList Obliques MusicMath Donation Some of mine and my friends music projects on Spotify
tompad is offline   Reply With Quote
Old 12-23-2019, 04:05 AM   #654
reapero
Human being with feelings
 
Join Date: Aug 2011
Posts: 517
Default

Quote:
Originally Posted by Lokasenna View Post
What version of the library are you using? It is a bug, but one that I added a fix for a month ago. (v2.16.10)
I must be on the latest one since i update Reapack quite often but..how do i check which exact version i have? At the first comments of the Core.lua file it says "Lokasenna_GUI 2.9 Core functionality"

Inspecting the file "Class - Options.lua" here i can see the snippet of code you just posted as it is though, no errors, yet i still cant set a single option checklist to false using GUI.Val.

EDIT: ok, I can see i have 2.16.10 in the Browse packages window of Reapack

Last edited by reapero; 12-23-2019 at 04:36 AM.
reapero is offline   Reply With Quote
Old 12-27-2019, 10:39 AM   #655
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

Whoops; the bug fix only worked if you set the value directly using GUI.elms.my_checklist:val(false). Updating now.
__________________
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 12-28-2019, 01:09 PM   #656
Buy One
Human being with feelings
 
Buy One's Avatar
 
Join Date: Sep 2019
Posts: 1,134
Default

Maybe my question is not specific for the GUI library and applies to general scripting techniques, but since it's inspired by my experience with the Menubar element i'll dare to ask here

Is there a way, preferably simple, since i'm coding illiterate, to force the drop-down menu to stay on after a menu item has been clicked?
Buy One is offline   Reply With Quote
Old 12-28-2019, 02:58 PM   #657
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

Nope.

The dropdown menu is completely handled by Reaper; scripts just tell it where the labels, folders, separators, etc are. Scripts are also paused until the user picks something.
__________________
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 12-28-2019, 03:44 PM   #658
Buy One
Human being with feelings
 
Buy One's Avatar
 
Join Date: Sep 2019
Posts: 1,134
Default

OK, thank you for the info
Buy One is offline   Reply With Quote
Old 01-08-2020, 10:44 PM   #659
MusoBob
Human being with feelings
 
MusoBob's Avatar
 
Join Date: Sep 2014
Posts: 2,643
Default

If you could you could get something like this for Lua scripting in Ardour would be very helpful as it's very limited without a GUI.
https://discourse.ardour.org/t/lua-s...brary/102423/2
__________________
ReaTrakStudio Chord Track for Reaper forum
www.reatrak.com
STASH Downloads https://stash.reaper.fm/u/ReaTrak
MusoBob is offline   Reply With Quote
Old 01-09-2020, 07:26 AM   #660
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
If you could you could get something like this for Lua scripting in Ardour would be very helpful as it's very limited without a GUI.
https://discourse.ardour.org/t/lua-s...brary/102423/2
I don't know C++ either.
__________________
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 01-11-2020, 04:46 AM   #661
Fabian
Human being with feelings
 
Fabian's Avatar
 
Join Date: Sep 2008
Location: Sweden
Posts: 7,417
Default Strange behavior on resize...

Maybe I am doing something wrong, but I get very strange behavior on resize.



First of all, I have to click one of the text boxes before getting any response to the resize. But then, after having clicked on, after resize some strange frame is painted on the non-focused text box.

This code
Code:
-- Standard code for loading the library removed

GUI.name = SCRIPT_NAME
GUI.x, GUI.y, GUI.w, GUI.h = ORIG_X, ORIG_Y, ORIG_W, ORIG_H
GUI.anchor, GUI.corner = "screen", "TL"

GUI.New("txted_text", "TextEditor", 1, 10, 10, ORIG_W-20, (ORIG_H-20)/2, "Select an item\nor two\nor three\nor everything\n\nin the list\nand click the button!")
GUI.New("texted2", "TextEditor", 1, 10, 20+(ORIG_H-20)/2, ORIG_W-20, (ORIG_H-20)/2, "Another text editor...")

function resize()
	GUI.elms.txted_text.w = GUI.cur_w - 20
	GUI.elms.texted2.w = GUI.cur_w - 20
end -- resize()

GUI.onresize = resize
GUI.Init()
GUI.Main()
This is v 2.16.11
__________________
// MVHMF
I never always did the right thing, but all I did wasn't wrong...
Fabian is offline   Reply With Quote
Old 01-12-2020, 09:03 AM   #662
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

When you resize the elements you also need to reinitialize them. Should just be:
Code:
function resize()
	GUI.elms.txted_text.w = GUI.cur_w - 20
	GUI.elms.texted2.w = GUI.cur_w - 20

  GUI.elms.txted_text:init()
  GUI.elms.texted2:init()
end
For most of the elements, when they're initialized they take a graphics buffer and draw their various parts to it. In the text editor's case, it draws its frame and then, right next to it, the same thing with the green "active" highlight.

When the GUI tells it to draw itself, it copies the appropriate area from that buffer. What you're seeing is it copying based on the new width but the source image was drawn at the original size, so it ends up taking some of the highlighted one as well.

Edit: You'll need to :redraw() both elements as well, I think, to have it updated right away.
__________________
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; 01-12-2020 at 09:08 AM.
Lokasenna is offline   Reply With Quote
Old 01-13-2020, 08:54 PM   #663
dsyrock
Human being with feelings
 
dsyrock's Avatar
 
Join Date: Sep 2018
Location: China
Posts: 565
Default

Is there any way to refresh the menubox option?

For example, the origin option is "A,B,C". Now if I change it to "A,B,C,D,E", how can I change the GUI of menubox without re-runing?
dsyrock is offline   Reply With Quote
Old 01-14-2020, 07:25 AM   #664
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

Quote:
Originally Posted by dsyrock View Post
Is there any way to refresh the menubox option?

For example, the origin option is "A,B,C". Now if I change it to "A,B,C,D,E", how can I change the GUI of menubox without re-runing?
Should be:
Code:
myMenubox.optarray = {"A", "B", "C", "D", "E"}
__________________
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 01-19-2020, 05:01 PM   #665
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

After slogging through documentation for a couple of months, I've come to the conclusion that it would be best to make v3 available for people to start testing in the meantime.

So...

"Lokasenna_Scythe library v3" is now available on ReaPack!!

Or you can clone the repository yourself and run the install script (it's in /library) from there.

Repository: https://github.com/jalovatt/scythe
Documentation (work in progress): https://jalovatt.github.io/scythe/

I'm working on docs for all of the element classes at the moment, after which I'll start moving over a bunch of content from the v2 wiki.
__________________
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; 01-20-2020 at 09:18 AM.
Lokasenna is offline   Reply With Quote
Old 01-20-2020, 12:43 AM   #666
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 4,937
Default

Quote:
Originally Posted by Lokasenna View Post
Note: For the moment it's marked as a pre-release, so in ReaPack -> Manage repositories -> Options you'll have to check 'Enable pre-releases globally".
In addition to that, the Scythe packages can alternatively be installed from the package browser (in case enabling all pre-releases globally via the bleeding edge mode option is not desired). Doing so enables pre-release updates only for those two packages until their next stable version.

Last edited by cfillion; 01-20-2020 at 12:51 AM.
cfillion is offline   Reply With Quote
Old 01-20-2020, 01:56 AM   #667
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,875
Default

Thx for the release and well done !


One error in demo script:

Script: Scythe_Example - Working with Images.lua


error:


Code:
image.lua:31: Couldn't load image: C:\Users\USER\AppData\Roaming\REAPER\Scripts\ReaTeam Scripts\Lokasenna_Scythe library v3\development\examples\Working with Images/guybrush small.png

Also, not sure what Script: Scythe_Test Runner.lua is supposed to do but I think there is wrong path somewhere
Code:
Running tests...

Failed to load test file:
    C:\Users\Anymord\AppData\Roaming\REAPER\Scripts\ReaTeam Scripts\Lokasenna_Scythe library v3\development\testing\




...







Side note,
In the text list demo script


Quote:
It was the day my grandmother exploded.
Quote:
Mother died today.
Quote:
They shoot the white girl first.

What an odd choice of quotes ! ^^
X-Raym is offline   Reply With Quote
Old 01-20-2020, 09:19 AM   #668
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

Quote:
Originally Posted by cfillion View Post
In addition to that, the Scythe packages can alternatively be installed from the package browser (in case enabling all pre-releases globally via the bleeding edge mode option is not desired). Doing so enables pre-release updates only for those two packages until their next stable version.
Ah, thank you.
__________________
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 01-20-2020, 09:23 AM   #669
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

Quote:
Originally Posted by X-Raym View Post
Thx for the release and well done !


One error in demo script:

Script: Scythe_Example - Working with Images.lua
Oops, fixing. I copied some "get all of the files" code from a separate script and forgot that it was filtering for only Lua files. :/

Quote:
Also, not sure what Script: Scythe_Test Runner.lua is supposed to do but I think there is wrong path somewhere
You need to load a test file - use the button on the right. There's an example in /development/testing, and tests for the public modules in /development/testing/public.

Making a note to have it default to the example file though.

Quote:
Side note,
In the text list demo script

...

What an odd choice of quotes ! ^^
They're the opening paragraphs from a random set of famous novels. I guess people dying is a great way to start your book.
__________________
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 02-09-2020, 03:27 PM   #670
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

Update: v3.0.0 has been released on ReaPack. Yay!

I'll make a separate thread for it when I get a chance, but you can have a look at the documentation at https://jalovatt.github.io/scythe.
__________________
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 02-09-2020, 03:51 PM   #671
MusoBob
Human being with feelings
 
MusoBob's Avatar
 
Join Date: Sep 2014
Posts: 2,643
Default

Thanks for 3 will check it out !

Quote:
Quote:
Originally Posted by MusoBob
If you could you could get something like this for Lua scripting in Ardour would be very helpful as it's very limited without a GUI.
https://discourse.ardour.org/t/lua-s...brary/102423/2
Quote:
Originally Posted by Lokasenna View Post
I don't know C++ either.
Hopefully they will implement some GUI elements now
https://discourse.ardour.org/t/is-op...s-really-want/
__________________
ReaTrakStudio Chord Track for Reaper forum
www.reatrak.com
STASH Downloads https://stash.reaper.fm/u/ReaTrak
MusoBob is offline   Reply With Quote
Old 02-09-2020, 04:17 PM   #672
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,875
Default

This website documentation is very welcome !
X-Raym is offline   Reply With Quote
Old 02-09-2020, 05:09 PM   #673
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

Quote:
Originally Posted by X-Raym View Post
This website documentation is very welcome !


Nobody ever seemed to find the wiki for v2, and this gives me way more control over everything.
__________________
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 02-21-2020, 08:39 AM   #674
jbradbury
Human being with feelings
 
jbradbury's Avatar
 
Join Date: Sep 2019
Location: Berlin
Posts: 61
Default hidpi fuzziness

Hello,

Thanks for your amazing work on this library. I thought about rolling my own GUI work but realised quickly that is not a simple task. I'm using your lib now and its incredibly helpful. I was wondering are the widgets meant to accomodate high resolution screens as my retina MBP draws quite fuzzy. Perhaps I'm missing something with how the GUI is initialised or perhaps I can be pointed in the right direction for fixing this.

Again, I don't meant to say this to undermine the hard work - i'm blown away!
jbradbury is offline   Reply With Quote
Old 02-21-2020, 09:14 AM   #675
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

There's no high-DPI support at the moment - everything is drawn in regular old pixels, and nothing is scaled on larger screens.

It's one of the top items on my to-do list though.
__________________
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 02-27-2020, 10:31 AM   #676
BirdBird
Human being with feelings
 
BirdBird's Avatar
 
Join Date: Mar 2019
Posts: 425
Default

Awesome work on the new documentation, looks really nice!

I have found a bug while playing around, buttons seem to get stuck if you spam click them: https://streamable.com/1ewm1
BirdBird is offline   Reply With Quote
Old 03-09-2020, 07:14 AM   #677
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,451
Default

I have created this simple slider using the GUI Builder:
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 - Slider.lua")()
-- If any of the requested libraries weren't found, abort the script.
if missing_lib then return 0 end

GUI.name = "Test Contrast"
GUI.x, GUI.y, GUI.w, GUI.h = 0, 0, 288, 76
GUI.anchor, GUI.corner = "screen", "C"

GUI.New("Contrast", "Slider", {
    z = 11,
    x = 16,
    y = 32,
    w = 255,
    caption = "Contrast",
    min = -127,
    max = 127,
    defaults = {127},
    inc = 1,
    dir = "h",
    font_a = 2,
    font_b = 3,
    col_txt = "txt",
    col_fill = "elm_fill",
    bg = "wnd_bg",
    show_handles = true,
    show_values = true,
    cap_x = 0,
    cap_y = 0
})

GUI.Init()
GUI.Main()

Before this code I have created a function with one argument. What should be add to the script code so that the following happens? :
- if user moves the slider, and only when the mouse button is released, then the current value of the slider is compared to the value when the mouse button was pressed, and if they are different, only then the function is run taking as an argument the current slider value.

Thanks!
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)

Last edited by amagalma; 03-11-2020 at 05:38 PM.
amagalma is offline   Reply With Quote
Old 03-11-2020, 05:48 PM   #678
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,451
Default

Using V2.x...

When I programmatically set an item selected in a ListBox:
Code:
GUI.Val("my_listbox", 4)
the correct item (fourth) gets selected. But when I try to get the value, it is still the previous one:
Code:
function FUNC()
  Sel = GUI.Val("my_listbox")
end

GUI.func = FUNC
Sel is still the previous value (1), while it should be 4. It changes only when I click an item.

I hope you understand what I mean... Why is that? Is it a bug or am I doing something wrong?
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)

Last edited by amagalma; 03-12-2020 at 04:19 PM.
amagalma is offline   Reply With Quote
Old 03-12-2020, 01:53 AM   #679
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,451
Default

I had to do this so that I always get the correct value:
Code:
function FUNC()

  -- get selected item
  for k in pairs(GUI.elms.my_listbox.retval) do
    if GUI.elms.my_listbox.retval[k] then
      selected = k
    end
  end
end

GUI.func = FUNC
Is this the right way? Or could it be done better?
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)

Last edited by amagalma; 03-12-2020 at 04:19 PM.
amagalma is offline   Reply With Quote
Old 03-12-2020, 04:18 PM   #680
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,451
Default

You can ignore my questions as I found solutions
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)
amagalma 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:35 AM.


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