Project

General

Profile

Actions

Improvements #14321

open

Clarification WApplication::globalKeyWentDown/Up and WDialog::keyWentDown/Up

Added by Michael Seibt 4 days ago. Updated 4 days ago.

Status:
New
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
02/10/2026
Due date:
% Done:

0%

Estimated time:

Description

Affected: docs and concept of Wt 4.12.2 (and former versions)
split from Improvements #13791: WApplication::globalKeyWentDown dead as long as WMenu focused by mouse click

from https://www.webtoolkit.eu/wt/doc/reference/html/classWt_1_1WApplication.html#a0a9652fc0d0cbebca7966f98454b078a:

Wt::WApplication::globalKeyWentDown()
Event signal emitted when a keyboard key is pushed down.
The application receives key events when no widget currently has focus. Otherwise, key events are handled by the widget in focus, and its ancestors.

from https://www.webtoolkit.eu/wt/doc/reference/html/classWt_1_1WDialog.html#a7da2f1f110190cc345b34ba4a6f35301:

Wt::WDialog::keyWentDown()
Event signal emitted when a keyboard key is pushed down.
The event will be triggered if nothing in the WDialog has focus

  1. Both docs are not exact. "no widget" / "nothing" might mean "no WFormWidget" or some other base class. The events do fire if f.i. a WTableView is focused.
  2. In UI frameworks, globalKeyWentDown usually fires on all key presses regardless of the focus (and provides means to intercept keypresses). One can simulate this to a certain degree by adding the handler to all widgets. This is error-prone, pretty inconvenient and not feasible for e.g. WMenu because it does not expose such signals.
  3. I see no difference between these signals of WApplication and WDialog. Why different names?

Files

main.cpp (16.6 KB) main.cpp Michael Seibt, 02/10/2026 04:10 PM
Actions #1

Updated by Michael Seibt 4 days ago

attached WDialog with different widgets and trace output from both key handlers

Actions

Also available in: Atom PDF