View Single Post
Old 06-28-2020, 06:48 PM   #724
cohler
Human being with feelings
 
Join Date: Dec 2018
Posts: 248
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.com https://cohlerclassical.com

Last edited by cohler; 06-29-2020 at 05:52 AM. Reason: Added LICEcap video
cohler is offline   Reply With Quote