Hi leo,
Thank you for your suggestion!
I understand your point: if the toolbar height is fixed, I can subtract the toolbar height from the Y coordinate when opening the toolbar, so that the top edge aligns with the mouse position. Each of my toolbars has a fixed height, and I can set a separate offset for each one.
However, when I tried to set the offset in my script, it did not work as expected—the toolbar still appears centered on the mouse Y coordinate, instead of aligning the top edge.
Could you please show me, based on my code below, how to set a different offset for each toolbar so that the top edge of the toolbar appears at the mouse position?
Thank you very much!
Here is my code:
function OnClick(clickData)
{
var cmd = clickData.func.command;
cmd.deselect = false;
if (clickData.func.sourcetab.selected.count == 0) {
cmd.RunCommand('Toolbar NAME="常用软件" FLOAT=active,vertical,toplevel,hotkeys,frame,roundededges,locked POS=mousel APPBAR=off TOGGLE AUTOCLOSE');
return;
}
var item = clickData.func.sourcetab.selected(0);
if (item.is_dir) {
DOpus.SendKey("shift+f10");
} else {
var iGroups = item.groups;
if (iGroups.empty) {
cmd.RunCommand('Toolbar NAME="F4menu-文本" FLOAT=active,vertical,toplevel,hotkeys,frame,roundededges,locked POS=mousel APPBAR=off TOGGLE AUTOCLOSE');
}
else if (iGroups(0) == "Images") {
cmd.RunCommand('Toolbar NAME="F4menu-图片" FLOAT=active,vertical,toplevel,hotkeys,frame,roundededges,locked POS=mousel APPBAR=off TOGGLE AUTOCLOSE');
}
else if (iGroups(0) == "Music") {
cmd.RunCommand('Toolbar NAME="F4menu-视频" FLOAT=active,vertical,toplevel,hotkeys,frame,roundededges,locked POS=mousel APPBAR=off TOGGLE AUTOCLOSE');
}
else if (iGroups(0) == "Movie") {
cmd.RunCommand('Toolbar NAME="F4menu-视频" FLOAT=active,vertical,toplevel,hotkeys,frame,roundededges,locked POS=mousel APPBAR=off TOGGLE AUTOCLOSE');
}
else if (iGroups(0).display_name == "Doc文档") {
cmd.RunCommand('Toolbar NAME="F4menu-Doc文档" FLOAT=active,vertical,toplevel,hotkeys,frame,roundededges,locked POS=mousel APPBAR=off TOGGLE AUTOCLOSE');
}
else if (iGroups(0).display_name == "PDF文档") {
cmd.RunCommand('Toolbar NAME="F4menu-PDF文档" FLOAT=active,vertical,toplevel,hotkeys,frame,roundededges,locked POS=mousel APPBAR=off TOGGLE AUTOCLOSE');
}
else if (iGroups(0) == "Archives") {
cmd.RunCommand('Toolbar NAME="F4menu-压缩" FLOAT=active,vertical,toplevel,hotkeys,frame,roundededges,locked POS=mousel APPBAR=off TOGGLE AUTOCLOSE');
}
else {
cmd.RunCommand('Toolbar NAME="F4menu-文本" FLOAT=active,vertical,toplevel,hotkeys,frame,roundededges,locked POS=mousel APPBAR=off TOGGLE AUTOCLOSE');
}
}
}
Thanks again for your help!