Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
嗨,我用“undotext”小部件编写了一个脚本,我正在寻找一种方法来获取鼠标光标所在位置的行索引。
同样,当用户选择了该行的一部分时。
要获取鼠标光标在文本坐标中的当前位置(不仅仅是 x,y),您需要执行以下任一操作:
$txt->index("current");
或者这个(其中$x并给出相对于文本小部件$y的鼠标光标位置):
$x
$y
$txt->index("@$x,$y");
第一个肯定更方便,但如果您处于拖动过程中,则需要第二个(current当任何鼠标按钮按下时标记不会更新)。
current