Old 06-17-2020, 06:54 PM   #721
jkooks
Human being with feelings
 
Join Date: May 2020
Posts: 46
Default

Quote:
Originally Posted by solger View Post
I guess it's possible by making a custom function in your script for creating and returning a 'full' selection table.
I ended up just creating another return value within the listbox class that keeps track of everything and returns it as the full bool list.


Quote:
Originally Posted by solger View Post
What's the use-case for which you require the 'full' listbox selection table?
I tend to iterate through the entire list in order to remove certain objects from arrays and what not, so only having the partial array would never work for me because I need the index of what items are true or not. At least in my opinion, having this full list is a lot more useful then only having the partial list.


Quote:
Originally Posted by solger View Post
By the way: are you using v2 or v3 (Scythe) of the GUI library?
I am currently using v2.
jkooks is offline   Reply With Quote
Old 06-28-2020, 08:50 AM   #722
cohler
Human being with feelings
 
Join Date: Dec 2018
Posts: 240
Default GUI Label element not displaying above a certain font size

Is there some maximum font point size above which the Label element does not work?

I have a label that I resize according to size of the GUI window. Above a certain size, it vanishes, and then comes back if I resize down back below that size.

Is this a Windows limitation? Anybody know?
__________________
Source-Destination 4-Point Editing for REAPER!
Available NOW for PC & Mac • FREE Trial License included
info@cohlerclassical.comhttps://cohlerclassical.com
cohler is offline   Reply With Quote
Old 06-28-2020, 09:29 AM   #723
cohler
Human being with feelings
 
Join Date: Dec 2018
Posts: 240
Default Maximum height appears to be 255 pixels

Did some more testing.

Above 255 pixel height as returned by gfx.measurestr on Windows, the caption just vanishes.

Is this a known PC/Windows limitation? On Mac it goes to any size.
__________________
Source-Destination 4-Point Editing for REAPER!
Available NOW for PC & Mac • FREE Trial License included
info@cohlerclassical.comhttps://cohlerclassical.com
cohler is offline   Reply With Quote
Old 06-28-2020, 06:48 PM   #724
cohler
Human being with feelings
 
Join Date: Dec 2018
Posts: 240
Default Lokasenna GUI window problem on Windows only

I have simplified this function as much as possible and provided LICEcap videos below to demonstrate the problem.

The function below creates a GUI window to display a 3-digit number with leading zeros as necessary using the Lokasenna GUI V2.

Initially the window is sized 349x291 and the font size of the number is 255.

As the user drags the corner of the window to resize it, the GUI.onresize function adjusts the font size of the number to fit in the window at the same ratio while keeping it in the center.

This code works perfectly on the Mac. On Windows it works ONLY when the window is sized such that the height of the number in the window is 255 or less. When the number is a height of 256 or more, it disappears!

Any insights or help would be appreciated!

Code:
function Number(n)
  local lib_path = reaper.GetExtState("Lokasenna_GUI", "lib_path_v2")
  loadfile(lib_path .. "Core.lua")(); GUI.req("Classes/Class - Label.lua")()

  local w,h,sz = 349,291,255
  GUI.name, GUI.fonts.bigfont = "Number", {"Calibri",sz}  
  GUI.x, GUI.y, GUI.w, GUI.h = 0, 0, w, h
  GUI.anchor, GUI.corner, GUI.freq = "screen", "C", .03
  GUI.colors.wnd_bg = {255,255,255,255}
  
  GUI.New("mylabel", "Label", 1, 20, 20, string.format("%03d",n), 
          false, "bigfont", "white", "black")
          
  local rw,rh,bf,label = sz/w, sz/h, GUI.fonts.bigfont, GUI.elms.mylabel
  GUI.onresize = function()
    bf[2] = math.floor(math.min(GUI.cur_h*rh,GUI.cur_w*rw))
    label.x, label.y = GUI.center(label)      
    GUI.Val("mylabel",label.caption)
  end

  GUI.Init(); GUI.Main()
end
Number(1)
Here is the INCORRECT behavior on Windows...



Here is the CORRECT behavior on Mac OS X...

__________________
Source-Destination 4-Point Editing for REAPER!
Available NOW for PC & Mac • FREE Trial License included
info@cohlerclassical.comhttps://cohlerclassical.com

Last edited by cohler; 06-29-2020 at 05:52 AM. Reason: Added LICEcap video
cohler is offline   Reply With Quote
Old 07-09-2020, 09:45 AM   #725
aurelien
Human being with feelings
 
Join Date: Apr 2014
Posts: 48
Default

Hello all,
Thanks for this great library, was able to create my GUI with v3.
However, I'm having a really hardtime using listbox : i spent two hours trying to add an element in my listbox...

Spent some times in the example, but there's no example of adding an element in a listbox.

I just have a button mapped to add a value in my table, and maybe refresh the listbox.

If someone is able to help

Thanks!

PHP Code:
squares = {149162536496481}
local function addText()
  -- 
Get the list boxs selected item(s)
  
local selected GUI.Val("lst_titles")
  
local lstbox GUI.findElementByName("lst_titles")

    -- 
Get and sort the selected item numbers
    
for kv in pairs(selected) do
        
Msg(v)
        
Msg(k)
    
end
    
     table
.insert(squares99)
     
lstbox.recalculateWindow()
     
end 

Last edited by aurelien; 07-09-2020 at 09:58 AM.
aurelien is offline   Reply With Quote
Old 07-09-2020, 10:23 AM   #726
solger
Human being with feelings
 
solger's Avatar
 
Join Date: Mar 2013
Posts: 4,638
Default

.list lets you get/set the current list values: https://jalovatt.github.io/scythe/#/...ements/Listbox

Here are two short examples to try:


1) Updating the squares table and passing this one to the listbox
PHP Code:
local squares = {149162536496481}

local function addText()
    
table.insert(squares99)
    
myListBox.list = squares
end 
2) Or updating the list directly:
PHP Code:
local squares = {149162536496481}

-- 
version 1
local 
function addText()
    
local listboxEntries myListBox.list 
    
table.insert(listboxEntries99)
end

-- version 2
local 
function addText()
    
table.insert(myListBox.list, 99)
end 
myListBox in the examples is the variable name:
Code:
 
local myListBox = GUI.createElement({
...
As mentioned in the link, calling Listbox:recalculateWindow() is only necessary when changing certain listbox parameters:
Quote:
Listbox:recalculateWindow()
Update internal values for the window size. If you change the listbox's w, h, pad, or textFont, this method should be called afterward.
__________________
ReaLauncher

Last edited by solger; 07-09-2020 at 10:35 AM.
solger is offline   Reply With Quote
Old 07-09-2020, 12:14 PM   #727
aurelien
Human being with feelings
 
Join Date: Apr 2014
Posts: 48
Default

Thanks for this awesome reply.
I'm not used to lua and basic functions are taking quite some time for me !

It's working great now
aurelien 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:54 AM.


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