I've ran into this problem, too; best as I could see, it wasn't possible
to use the keys with that particular entry box, so I made a few
modifications to the axis.py script to give me left + right, home and
end keys. It seems to have worked fine for me, for > 6 months.

Philip

>From 17a55baf3af55a5f70a5e9e034810b790d6a06a4 Mon Sep 17 00:00:00 2001
From: Philip Mullen <suavest...@hotmail.com>
Date: Tue, 22 Aug 2017 09:53:45 +0100
Subject: [PATCH] axis.py add support for MDI cursor movement

Allow the keyboard to move the cursor in the MDI entry box
---
 src/emc/usr_intf/axis/scripts/axis.py | 38 ++++++++++++++++++++++++++++++++---
 1 file changed, 35 insertions(+), 3 deletions(-)

diff --git a/src/emc/usr_intf/axis/scripts/axis.py b/src/emc/usr_intf/axis/scripts/axis.py
index 55ad515..dfe50a8 100755
--- a/src/emc/usr_intf/axis/scripts/axis.py
+++ b/src/emc/usr_intf/axis/scripts/axis.py
@@ -2298,7 +2298,6 @@ class TclCommands(nf.TclCommands):
             if mdi_history_index != (widgets.mdi_history.size() - 1):
                 widgets.mdi_history.selection_set(mdi_history_index, mdi_history_index)
             vars.mdi_command.set(widgets.mdi_history.get(mdi_history_index))
-            widgets.mdi_command.selection_range(0, "end")
 
     def mdi_down_cmd(*args):
         if args and args[0].char: return   # e.g., for KP_Up with numlock on
@@ -2316,7 +2315,34 @@ class TclCommands(nf.TclCommands):
             if mdi_history_index != (widgets.mdi_history.size() - 1):
                 widgets.mdi_history.selection_set(mdi_history_index, mdi_history_index)
             vars.mdi_command.set(widgets.mdi_history.get(mdi_history_index))
-            widgets.mdi_command.selection_range(0, "end")
+
+    def mdi_left_cmd(*args):
+        if args and args[0].char: return
+        if widgets.mdi_command.cget("state") == "disabled":
+            return
+
+        widgets.mdi_command.icursor(widgets.mdi_command.index(INSERT) - 1)
+
+    def mdi_right_cmd(*args):
+        if args and args[0].char: return
+        if widgets.mdi_command.cget("state") == "disabled":
+            return
+
+        widgets.mdi_command.icursor(widgets.mdi_command.index(INSERT) + 1)
+
+    def mdi_end_cmd(*args):
+        if args and args[0].char: return
+        if widgets.mdi_command.cget("state") == "disabled":
+            return
+
+        widgets.mdi_command.icursor(widgets.mdi_command.index(END))
+
+    def mdi_home_cmd(*args):
+        if args and args[0].char: return
+        if widgets.mdi_command.cget("state") == "disabled":
+            return
+
+        widgets.mdi_command.icursor(0)
 
     def send_mdi(*event):
         if not manual_ok(): return "break"
@@ -2429,6 +2455,7 @@ class TclCommands(nf.TclCommands):
         if bbox and (event.y <= (bbox[1] + bbox[3])) and  (cursel < widgets.mdi_history.size() - 1):
             mdi_history_index = cursel
             vars.mdi_command.set(widgets.mdi_history.get(cursel))
+            widgets.mdi_command.focus_set()
         else:
             widgets.mdi_history.see("end")
             widgets.mdi_history.selection_clear(0, "end")
@@ -3039,9 +3066,15 @@ widgets.mdi_command.bind("<Control-Shift-H>", commands.mdi_history_clip2hist)
 widgets.mdi_command.bind("<Key-Return>", commands.send_mdi)
 widgets.mdi_command.bind("<Up>",  commands.mdi_up_cmd)
 widgets.mdi_command.bind("<Down>", commands.mdi_down_cmd)
+widgets.mdi_command.bind("<Left>",  commands.mdi_left_cmd)
+widgets.mdi_command.bind("<Right>",  commands.mdi_right_cmd)
 widgets.mdi_command.bind("<Key-KP_Enter>", commands.send_mdi)
 widgets.mdi_command.bind("<KP_Up>",  commands.mdi_up_cmd)
 widgets.mdi_command.bind("<KP_Down>", commands.mdi_down_cmd)
+widgets.mdi_command.bind("<KP_Left>",  commands.mdi_left_cmd)
+widgets.mdi_command.bind("<KP_Right>",  commands.mdi_right_cmd)
+widgets.mdi_command.bind("<Home>", commands.mdi_home_cmd)
+widgets.mdi_command.bind("<End>", commands.mdi_end_cmd)
 widgets.mdi_command.bind("<KeyRelease-minus>", "break")
 widgets.mdi_command.bind("<KeyRelease-equal>", "break")
 
@@ -3681,7 +3714,6 @@ def get_coordinate_font(large):
 
 root_window.bind("<Key-F3>", pane_top + ".tabs raise manual")
 root_window.bind("<Key-F5>", pane_top + ".tabs raise mdi")
-root_window.bind("<Key-F5>", "+" + tabs_mdi + ".command selection range 0 end")
 root_window.bind("<Key-F4>", commands.next_tab)
 
 init()
-- 
2.9.4

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to