JMessmer
April 1st, 2024, 19:41
I am trying to identify the current cursor position of a user on a windowlist.
So I am using this code:
...
DebugManager.printDebugMessage2(sScriptName, sFuncName, "window: ", window);
DebugManager.printDebugMessage2(sScriptName, sFuncName, "x: ", x);
DebugManager.printDebugMessage2(sScriptName, sFuncName, "y: ", y);
local winlistEntry = window.getWindowAt(x, y);
if winlistEntry and winlistEntry.shortcut then
local xLinkMin, yLinkMin = winlistEntry.getPosition();
DebugManager.printDebugMessage2(sScriptName, sFuncName, "xLinkMin: ", xLinkMin);
DebugManager.printDebugMessage2(sScriptName, sFuncName, "yLinkMin: ", yLinkMin);
local xTmp, yTmp = winlistEntry.shortcut.getPosition();
DebugManager.printDebugMessage2(sScriptName, sFuncName, "xTmp: ", xTmp);
DebugManager.printDebugMessage2(sScriptName, sFuncName, "yTmp: ", yTmp);
DebugManager.printDebugMessage2(sScriptName, sFuncName, "winlistEntry: ", winlistEntry);
DebugManager.printDebugMessage2(sScriptName, sFuncName, "winlistEntry.shortcut: ", winlistEntry.shortcut);
...
end
and I am getting this output:
[4/1/2024 8:22:42 PM] s'gm | scripts/manager_droptype_dsa.lua, processListDrop, window: ' | windowlist = { windows = #29, name = s'inventorylist1', x,y,w,h = 25,47,448,260 }
[4/1/2024 8:22:42 PM] s'gm | scripts/manager_droptype_dsa.lua, processListDrop, x: ' | #435
[4/1/2024 8:22:42 PM] s'gm | scripts/manager_droptype_dsa.lua, processListDrop, y: ' | #557
[4/1/2024 8:22:42 PM] s'gm | scripts/manager_droptype_dsa.lua, processListDrop, xLinkMin: ' | #929
[4/1/2024 8:22:42 PM] s'gm | scripts/manager_droptype_dsa.lua, processListDrop, yLinkMin: ' | #541
[4/1/2024 8:22:42 PM] s'gm | scripts/manager_droptype_dsa.lua, processListDrop, xTmp: ' | #426
[4/1/2024 8:22:42 PM] s'gm | scripts/manager_droptype_dsa.lua, processListDrop, yTmp: ' | #3
[4/1/2024 8:22:42 PM] s'gm | scripts/manager_droptype_dsa.lua, processListDrop, winlistEntry: ' | windowinstance = { class = charsheet_inventoryitem_all, node = charsheet.id-00006.inventorylist.id-00027, x,y,w,h = 0,546,448,21 }
[4/1/2024 8:22:42 PM] s'gm | scripts/manager_droptype_dsa.lua, processListDrop, winlistEntry.shortcut: ' | windowreferencecontrol = { name = s'shortcut', x,y,w,h = 426,3,20,16 }
The shortcut is a match and seems to be correct - but the windowlist x-axis it totally off: #929 vs 0 and the y-axis is #541 vs 546.
Why do the x and y position of windowinstance output differ so much from the output of the function call? Obviously, winlistEntry knows its correct position?
Am I missing something?
So I am using this code:
...
DebugManager.printDebugMessage2(sScriptName, sFuncName, "window: ", window);
DebugManager.printDebugMessage2(sScriptName, sFuncName, "x: ", x);
DebugManager.printDebugMessage2(sScriptName, sFuncName, "y: ", y);
local winlistEntry = window.getWindowAt(x, y);
if winlistEntry and winlistEntry.shortcut then
local xLinkMin, yLinkMin = winlistEntry.getPosition();
DebugManager.printDebugMessage2(sScriptName, sFuncName, "xLinkMin: ", xLinkMin);
DebugManager.printDebugMessage2(sScriptName, sFuncName, "yLinkMin: ", yLinkMin);
local xTmp, yTmp = winlistEntry.shortcut.getPosition();
DebugManager.printDebugMessage2(sScriptName, sFuncName, "xTmp: ", xTmp);
DebugManager.printDebugMessage2(sScriptName, sFuncName, "yTmp: ", yTmp);
DebugManager.printDebugMessage2(sScriptName, sFuncName, "winlistEntry: ", winlistEntry);
DebugManager.printDebugMessage2(sScriptName, sFuncName, "winlistEntry.shortcut: ", winlistEntry.shortcut);
...
end
and I am getting this output:
[4/1/2024 8:22:42 PM] s'gm | scripts/manager_droptype_dsa.lua, processListDrop, window: ' | windowlist = { windows = #29, name = s'inventorylist1', x,y,w,h = 25,47,448,260 }
[4/1/2024 8:22:42 PM] s'gm | scripts/manager_droptype_dsa.lua, processListDrop, x: ' | #435
[4/1/2024 8:22:42 PM] s'gm | scripts/manager_droptype_dsa.lua, processListDrop, y: ' | #557
[4/1/2024 8:22:42 PM] s'gm | scripts/manager_droptype_dsa.lua, processListDrop, xLinkMin: ' | #929
[4/1/2024 8:22:42 PM] s'gm | scripts/manager_droptype_dsa.lua, processListDrop, yLinkMin: ' | #541
[4/1/2024 8:22:42 PM] s'gm | scripts/manager_droptype_dsa.lua, processListDrop, xTmp: ' | #426
[4/1/2024 8:22:42 PM] s'gm | scripts/manager_droptype_dsa.lua, processListDrop, yTmp: ' | #3
[4/1/2024 8:22:42 PM] s'gm | scripts/manager_droptype_dsa.lua, processListDrop, winlistEntry: ' | windowinstance = { class = charsheet_inventoryitem_all, node = charsheet.id-00006.inventorylist.id-00027, x,y,w,h = 0,546,448,21 }
[4/1/2024 8:22:42 PM] s'gm | scripts/manager_droptype_dsa.lua, processListDrop, winlistEntry.shortcut: ' | windowreferencecontrol = { name = s'shortcut', x,y,w,h = 426,3,20,16 }
The shortcut is a match and seems to be correct - but the windowlist x-axis it totally off: #929 vs 0 and the y-axis is #541 vs 546.
Why do the x and y position of windowinstance output differ so much from the output of the function call? Obviously, winlistEntry knows its correct position?
Am I missing something?