[JW Lua] Dialog scaling bug not fixed when changing the positions afterwards - fixed

Jan Angermüller jan at angermueller.com
Wed Oct 25 14:03:10 CEST 2017


It's not a scaling bug, but different origins.
FCCtrl:SetLeft/SetTop uses the top left corner (0,0) of the dialog 
window as the origin,
while FCCtrl...:Create..(x,y) seems to use (11,11) as the origin (on 
Windows - haven't checked Mac).
I.e. a margin is automatically added when creating the elements.

So these should address the same position:
local button = dialog:CreateButton(50, 50)

button:SetLeft(50+11)
button:SetTop(50+11)

Maybe this should be added to the documentation?

Jan



-------- Weitergeleitete Nachricht --------
Betreff: 	[JW Lua] Dialog scaling bug not fixed when changing the 
positions afterwards
Datum: 	Wed, 25 Oct 2017 13:12:26 +0200
Von: 	Jan Angermüller <jan at angermueller.com>
Antwort an: 	The JW Lua script plug-in. <jwlua at jwmusic.nu>
An: 	The JW Lua script plug-in. <jwlua at jwmusic.nu>



Jari,

some versions ago you fixed the different scaling/positioning bug for 
dialogs on MacOS/Windows.
Today I noticed that the bug fix seem to only affect the 
scaling/positioning when creating the dialog.
If the dialog is changed on the fly afterwards, the values are still 
scaled differently (on Windows! Haven't tested MacOS).

Below is the test script which shows different positions when using 
CreateButton(x,y) compared to SetLeft(x) / SetTop(y).
Clicking on the "select" button should use the same position as before, 
but it changes.
This is how the script looks in action: https://youtu.be/gprmtghPbAs

It is relevant when I have a dialog with a "standard" and an "extended" 
version which use slightly different positions.

Jan

local str=finale.FCString()
str.LuaString="Test"
local dialog = finale.FCCustomLuaWindow()
dialog:SetTitle(str)

local static1= dialog:CreateStatic(0,0)
str.LuaString = "Test:"
static1:SetWidth(120)
static1:SetText(str)

local button = dialog:CreateButton(50, 50)
str.LuaString = "Select"
button:SetText(str)
button:SetWidth(100)

local function mycommandhandler(thecontrol)
     if thecontrol:GetControlID() ==button:GetControlID() then
         button:SetLeft(50)
         button:SetTop(50)
     end
end
dialog:RegisterHandleCommand(mycommandhandler)
dialog:CreateCancelButton()
dialog:ExecuteModal(nil)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://jwmusic.nu/pipermail/jwlua_jwmusic.nu/attachments/20171025/28c22013/attachment.htm>


More information about the JWLua mailing list