Why are my bindings blocked?

Peter Lewerin

I'm rewriting an already working application from the ground up, and a couple of modules in I hit a curious snag. At present, the only thing it does is read in CSV file into a dictionary, set up the GUI, and write the dictionary back to CSV. The GUI is supposed to open document windows for selections of the items in the dictionary as they are asked for: at present I just want it to open a window for all items when I press Return.

Yesterday it worked like it should. Today I made some changes to the CSV read/save commands, and suddenly the main window isn't responding any more. I have an exact diff of the changes, and none of them should affect the event handling.

The bindings look like this:

bind . <Escape> {exec wish $argv0 &; exit}
bind . <?> {catch {console show} ; ::log::lvSuppressLE warning 0}
bind . <Return> IDB::GUI::openwindow

I've looked on SO, on the wiki, and searched the web, but if this has been discussed before I seem to have missed it. I've tried, among other things, calling update and using bindtags to prioritize my bindings. None of this works, but if I add this after the bindings:

tk_messageBox -message foo

it works like a charm: all the bindings fire when I press the keys. Obviously the message box clears up something that is blocking the event delivery, but I can't figure out what it is.

I would very much like to avoid posting a nonsense message box just to get my application to respond.

And don't tell me God is punishing me for working on Good Friday.

ETA: it seems that a message box after setting up the GUI isn't sufficient, I need one before setting it up too. When I removed that one, the events stopped working again.

Edit after getting an answer: a simple focus . seems to be sufficient to keep my main window responsive. For good measure, I added another binding, bind . <Button-1> {focus .}, which I hope will enable me to restore focus if something diverts it again. I may also add some focus introspection to my application logging.

(Edit of the edit: of course, if one puts in the binding bind . <Button-1> {focus .} it helps immensely to remember to take it out once one starts adding e.g. entry widgets to the GUI: otherwise one might wonder briefly why one's entries don't get focus when they are clicked on. Simple? Of course I am.)

As Donal points out, <?> isn't a valid event code (it should be something like <Key-question>). It works for me, but if you decide to reuse that particular binding, bear in mind that it isn't in any way guaranteed to work for you.

Bryan Oakley

It sounds like your main window simply doesn't have the keyboard focus. Popping up the messagebox and then dismissing it probably has the side effect of setting focus to the main window.

Try explicitly setting focus on ..

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Java

Why are my component bindings undefined in its controller?

From Dev

Why is my RestEasy WebService blocked when my @Asynchronous method is working?

From Dev

Why my HP computer is getting blocked when It turns on?

From Dev

Qt 5.7 QML Why are my CheckBox property bindings disappearing?

From Dev

Why are some of my Angular JS data bindings not working?

From Dev

Why the threads are dead/blocked?

From Dev

Why bindings do not work?

From Dev

Why are my requests to web.api being blocked by long running controller code?

From Dev

Why does NgFor render "template_bindings = {}" in the DOM instead of the data-bound elements in my Component?

From Dev

Knockout Mapping: Why does apply bindings clear values from my nested objects?

From Dev

Why am I not able to get data to my AngularJS component via bindings?

From Dev

Why are localhost connections blocked by the firewall?

From Dev

Why the UI thread is getting blocked?

From Dev

Why are localhost connections blocked by the firewall?

From Dev

Why onActivityResult() is blocked by worker thread?

From Dev

Linux - FirewallD - Why is ping blocked?

From Dev

Does a thread that is blocked cause the process to become blocked? Why and How?

From Dev

Matrix-Multiplication: Why non-blocked outperforms blocked?

From Dev

How to check if URL is blocked by my firewall

From Dev

What is causing my UI Thread to be blocked?

From Dev

How my RAMs are blocked at 2666MHz?

From Dev

Property names are not available for my datagrid column bindings

From Dev

Why MySQL connection is blocked of many connection errors?

From Dev

Node.js with ImageMagick, why server is not blocked?

From Dev

Why is output of parent process blocked by child process?

From Dev

why here document make cat blocked

From Dev

Why are processes blocked when open FIFO

From Dev

Why does the SQL connection get blocked randomly?

From Dev

Software flow control: why TX is blocked on terminal?

Related Related

  1. 1

    Why are my component bindings undefined in its controller?

  2. 2

    Why is my RestEasy WebService blocked when my @Asynchronous method is working?

  3. 3

    Why my HP computer is getting blocked when It turns on?

  4. 4

    Qt 5.7 QML Why are my CheckBox property bindings disappearing?

  5. 5

    Why are some of my Angular JS data bindings not working?

  6. 6

    Why the threads are dead/blocked?

  7. 7

    Why bindings do not work?

  8. 8

    Why are my requests to web.api being blocked by long running controller code?

  9. 9

    Why does NgFor render "template_bindings = {}" in the DOM instead of the data-bound elements in my Component?

  10. 10

    Knockout Mapping: Why does apply bindings clear values from my nested objects?

  11. 11

    Why am I not able to get data to my AngularJS component via bindings?

  12. 12

    Why are localhost connections blocked by the firewall?

  13. 13

    Why the UI thread is getting blocked?

  14. 14

    Why are localhost connections blocked by the firewall?

  15. 15

    Why onActivityResult() is blocked by worker thread?

  16. 16

    Linux - FirewallD - Why is ping blocked?

  17. 17

    Does a thread that is blocked cause the process to become blocked? Why and How?

  18. 18

    Matrix-Multiplication: Why non-blocked outperforms blocked?

  19. 19

    How to check if URL is blocked by my firewall

  20. 20

    What is causing my UI Thread to be blocked?

  21. 21

    How my RAMs are blocked at 2666MHz?

  22. 22

    Property names are not available for my datagrid column bindings

  23. 23

    Why MySQL connection is blocked of many connection errors?

  24. 24

    Node.js with ImageMagick, why server is not blocked?

  25. 25

    Why is output of parent process blocked by child process?

  26. 26

    why here document make cat blocked

  27. 27

    Why are processes blocked when open FIFO

  28. 28

    Why does the SQL connection get blocked randomly?

  29. 29

    Software flow control: why TX is blocked on terminal?

HotTag

Archive