Skip Menu |

This queue is for tickets about the Tk CPAN distribution.

Report information
The Basics
Id: 96909
Status: new
Priority: 0/
Queue: Tk

People
Owner: Nobody in particular
Requestors: eeyles [...] graphic.plc.uk
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Window events trigger 'focusout' event in Entry widget
Date: Thu, 03 Jul 2014 09:37:02 +0100
To: bug-Tk [...] rt.cpan.org
From: Ed Eyles <eeyles [...] graphic.plc.uk>
Hello Certain events for a window appear to trigger the 'focusout' event for an Entry widget that is installed in that window. I do not believe this is sensible, because, as far as the user is concerned, the widget does not actually lose the focus in the course of these events. So, if we have a Tk window containing an Entry widget which has a validation command for the 'focusout' event, we can see that event get triggered when: * The window is moved with the mouse (but not when it is moved using the keyboard!). * The window control menu is invoked (i.e. the menu that is invoked by clicking the icon that is typically at the left-hand end of the title bar, or typically by pressing Alt-Space). * The window is "rolled up", so that only its title bar is visible. * The window is minimised. * The window itself loses focus. A sample program to create a Tk window in which this behaviour can be reproduced is as follows. #!/usr/bin/perl use strict; use warnings FATAL => 'all'; use diagnostics; use Tk; my $mw = MainWindow -> new; $mw -> Entry (-validate => 'focusout', -validatecommand => sub {print "Validating...\n"}) -> pack -> focus; MainLoop; I suppose I can see a kind of logic in the current behaviour: in any of those window operations listed above, either the "body" of the window loses focus, or the window itself does. However, I believe this defeats the purpose of the validation command, which is surely to enable a command to be run when the focus changes /within the window/. If the user switches focus to a window decoration, to another window, or to the desktop, the focus is not changed in the context of their Tk application, and, indeed, when they return the focus to that application, the focus is still within the Entry widget. I hope this makes some sense. FYI I am using: * CentOS 6.5 x86_64 * XFCE (xfdesktop 4.8.2 release 2.el6 for x86_64) * Perl "v5.10.1 (*) built for x86_64-linux-thread-multi" * Tk module 804.028503 Regards Ed Graphic PLC Tel. +44 (0) 1363 774874 Fax. +44 (0) 1363 775753 Website: www.graphic.plc.uk Before printing this email, please consider the environment. This e-mail and any files transmitted with it are intended for the exclusive use of the addressee only and may be confidential. If you are not the intended recipient, you should not use the contents nor disclose them to any other person, and you are requested to notify the sender and delete the email. Please note that design advice is given in good faith and without prejudice. Graphic cannot be held responsible for any product failure, or if systems do not perform as expected. Information given is for the use of the recipient only and others within their organisation; it should not be given to a third party without express authorisation from Graphic plc. ITAR regulations stipulate that customers must inform their suppliers if their products are subject to ITAR regulations. If no mention of the ITAR regulations is made on the quote request or the order then Graphic PLC will assume that the ITAR regulations do not apply. Internet communications are not secure, and Graphic PLC is not responsible for any changes made to the message after it was sent. Although steps have been taken to ensure that this email and any attachments are virus-free, Graphic plc cannot guarantee this, or accept liability for any damage sustained as a result of a virus. Recipients are advised to carry out their own virus checking, especially before opening an attachment. Graphic PLC, registered in England no. 1036230. Registered office: Graphic PLC, Down End, Lords Meadow Industrial Estate, Crediton, Devon, EX17 1HN, England.
Subject: [rt.cpan.org #96909]
Date: Fri, 04 Jul 2014 08:44:20 +0100
To: bug-Tk [...] rt.cpan.org
From: Ed Eyles <eeyles [...] graphic.plc.uk>
[I apologise for the lengthy e-mail footer - I cannot control this.] I have discovered a workaround for this issue: the validation command can check the value of (in the example script) $mw->focusCurrent. If the value is 'undef', that indicates that the focus has left the body of the Tk window. If the value is defined, the focus is still within the body of the Tk window. This won't stop the validation command firing unnecessarily, but it can be used to stop it doing anything when it doesn't need to. I feel this issue as reported is still a valid and significant one. Ed Graphic PLC Tel. +44 (0) 1363 774874 Fax. +44 (0) 1363 775753 Website: www.graphic.plc.uk Before printing this email, please consider the environment. This e-mail and any files transmitted with it are intended for the exclusive use of the addressee only and may be confidential. If you are not the intended recipient, you should not use the contents nor disclose them to any other person, and you are requested to notify the sender and delete the email. Please note that design advice is given in good faith and without prejudice. Graphic cannot be held responsible for any product failure, or if systems do not perform as expected. Information given is for the use of the recipient only and others within their organisation; it should not be given to a third party without express authorisation from Graphic plc. ITAR regulations stipulate that customers must inform their suppliers if their products are subject to ITAR regulations. If no mention of the ITAR regulations is made on the quote request or the order then Graphic PLC will assume that the ITAR regulations do not apply. Internet communications are not secure, and Graphic PLC is not responsible for any changes made to the message after it was sent. Although steps have been taken to ensure that this email and any attachments are virus-free, Graphic plc cannot guarantee this, or accept liability for any damage sustained as a result of a virus. Recipients are advised to carry out their own virus checking, especially before opening an attachment. Graphic PLC, registered in England no. 1036230. Registered office: Graphic PLC, Down End, Lords Meadow Industrial Estate, Crediton, Devon, EX17 1HN, England.