| Ticket UUID: | 3de1b721570ccbe2f17c3bd33f2129c6f02ae391 | |||
| Title: | ttk::notebook takes the focus when clicked, even with the -takefocus 0 option | |||
| Type: | Bug | Version: | 8.6.13 | |
| Submitter: | oehhar | Created on: | 2023-03-14 17:25:07 | |
| Subsystem: | 88. Themed Tk | Assigned To: | nobody | |
| Priority: | 5 Medium | Severity: | Minor | |
| Status: | Closed | Last Modified: | 2026-09-23 11:23:53 | |
| Resolution: | Fixed | Closed By: | nemethi | |
| Closed on: | 2026-09-23 11:23:53 | |||
| Description: |
ttk::notebook takes the focus when clicked, even with the -takefocus 0 option. System: MS-Windows 10 64 bit TCL/Tk: 8.6.13, 32 bit Native style Sample script: pack [ttk::entry .e -width 30] pack [ttk::button .b -text Button -takefocus 0] pack [ttk::notebook .n -takefocus 0 -width 30 -height 30] frame .n.f .n insert end .n.f -text Tab -sticky news focus .e The entry widget should keep the focus. When clicking on the button, the focus stays on the entry widget. When clicking on the Tab of the ttk::notebook, the focus is lost from the entry widget. Background: I am building a screen keyboard with buttons, which are aranged on tabs of a notebook. The target entry widget should constantly have the focus. Unfortunately, it looses focus, if the notebook tab is clicked. Is it me (again)? Thank you and take care, Harald | |||
| User Comments: |
nemethi (claiming to be Csaba Nemethi) added on 2026-09-23 11:23:53:
Many thanks, Serhiy! Merged into main, core-9-0-branch, and core-8-6-branch by commits [a695f427], [76f25dd9], and [08026898]. Closing the ticket. serhiy.storchaka added on 2026-09-19 17:41:00: Made the notebook behave like the themed buttons: with -takefocus 0 (or a command returning 0) clicking a tab no longer takes the focus away from another widget; the focus still leaves a deselected tab. Fixed in [cde76e63cf] (branch ttk-notebook-takefocus-click). oehhar added on 2023-03-17 14:33:59: Francois, thanks for looking into this, I appreciate. In my use-case, I would prefer that it works as with the ttk::button widget. As an interim solution, I have replaced the tabs by buttons and hiding the tabs. That works, but does not look nice. It would be ok to close the ticket and say "works as expected". But it could also be transofrmed to an RFE to have a way to not take the focus, like the button widget. I would favor for this. Thank you and take care, Harald fvogel added on 2023-03-16 20:45:31: Hmmm.. The man page for -takefocus says: "Determines whether the window accepts the focus during keyboard traversal." You are clicking in the widget, not using keyboard traversal. That said, the ttk::button does not behave the same. | |||
Home
Timeline
Branches
Tags
Forum
Tickets
Download
Wiki