Tk Source Code

View Ticket
Login
2025-08-12
08:31 Add attachment messagebox_full_screen_with_without_patch.png to ticket [e19f1d89] artifact: e4741410 user: oehhar
08:30 Ticket [e19f1d89] Limit tk_messageBox to physical screen width status still Open with 4 other changes artifact: 87e02d39 user: oehhar
2025-08-11
07:21
[e19f1d89] add widthdraw to avoid theoretical flickering. Leaf check-in: 1fbd5292 user: oehhar tags: e19f1d891-messagebox-screensize
2025-08-08
16:16 Ticket [e19f1d89] Limit tk_messageBox to physical screen width status still Open with 3 other changes artifact: 78bf915d user: oehhar
15:42 Ticket [e19f1d89]: 4 changes artifact: c73465dd user: nemethi
15:32 Ticket [e19f1d89]: 4 changes artifact: 3dbb62c9 user: oehhar
15:10 Ticket [e19f1d89]: 4 changes artifact: 5aea8053 user: nemethi
13:25 Ticket [e19f1d89]: 4 changes artifact: 07480027 user: oehhar
12:45 Ticket [e19f1d89]: 4 changes artifact: 9b90f4e7 user: oehhar
2025-08-04
15:26 Ticket [e19f1d89]: 4 changes artifact: a9c887bb user: nemethi
15:00
Ticket [e19f1d891]: Code refactoring and cleanup. Thanks to Christian W. for his input. check-in: 1153477b user: csaba tags: e19f1d891-messagebox-screensize
11:31 Ticket [e19f1d89] Limit tk_messageBox to physical screen width status still Open with 3 other changes artifact: e6631b68 user: oehhar
2025-08-03
19:25
Ticket [e19f1d891]: Revised the value of the minimum wrap length and its handling. check-in: 19300912 user: csaba tags: e19f1d891-messagebox-screensize
2025-08-02
14:26
Ticket [e19f1d891]: Get the frame width of toplevel windows in SDL2 Tk rather than assuming a value of 15. check-in: 09edf320 user: csaba tags: e19f1d891-messagebox-screensize
2025-07-29
14:58 Add attachment Screenshot_20250729-164803.png to ticket [e19f1d89] artifact: 24744544 user: oehhar
13:16 Ticket [e19f1d89] Limit tk_messageBox to physical screen width status still Open with 3 other changes artifact: 7ab4453e user: oehhar
13:15 Ticket [e19f1d89]: 3 changes artifact: 59197978 user: oehhar
13:12
Ticket [e19f1d891]: tk_messageBox width limitation to the physical screen check-in: 5a2361cd user: oehhar tags: e19f1d891-messagebox-screensize
13:02 New ticket [e19f1d89] Limit tk_messageBox to physical screen width. artifact: a1fed7fe user: oehhar

Ticket UUID: e19f1d8914442195a4de1aa787864fcdba3b5533
Title: Limit tk_messageBox to physical screen width
Type: RFE Version: main
Submitter: oehhar Created on: 2025-07-29 13:02:42
Subsystem: 38. [tk_messageBox] Assigned To: oehhar
Priority: 5 Medium Severity: Minor
Status: Open Last Modified: 2025-08-12 08:30:13
Resolution: None Closed By: nobody
    Closed on:
Description:

The native implementation in the file library/msgbox of the tk_messageBox is used on Linux and Androwish (https://core.tcl-lang.org/tk/file?name=library/msgbox.tcl&ln=313-314).

The wraplength of the contained ttk label widget is hard coded to "3i" and may be changed using the option data base (https://core.tcl-lang.org/tk/file?name=library/msgbox.tcl&ln=313-314).

The default of 3 inches is 76.2mm.

My Androwish device has a screen width of 65mm. Unfortunately, the message box does not fit, as borders and icon are also displayed.

This ticket proposes to limit the width of the message box to the physical screen width.

The branch [e19f1d891-messagebox-screensize] starting with commit [5a2361cd] has a proposed implementation.

A typical test message wraps at each 2nd character:

tk_messageBox -message [string repeat "1 " 100]

For me, this fits nearly exactly to the screen.

The related Androwish ticket is here: https://androwish.org/home/info/6cd64e3eeddaf1fd

Virtual Screen is left out. IMHO, this is outdated technology. But the implementation may easily be changed to use the virtual screen.

Any comment welcome !

Thanks, Harald

User Comments: oehhar added on 2025-08-12 08:30:13:

CI run is ok.

To test this, one may manually set the wrap length of the message box label above the screen width.

Here is my test script:

% winfo screenwidth .
1920
% option add *Dialog.msg.wrapLength [expr {[winfo screenwidth .]+100}]
% ::tk::MessageBox -message [string repeat "A123456789B123456789C123456789" 10]

The attached screenshot "messagebox_full_screen_with_without_patch.png" shows the patched version above, without patch below. This is on Windows. Of cause, this code is never active on Windows, as the native message box is used.

You may see, that the message is clipped without the patch, e.g. a part of the message is missing without the patch.

It may also be observed, that the placement is not exactly at the left border by tk::PlaceWindow. This is probably due to a windows manager border, not taken into account by the tk::PlaceWindow function.

The patch is clearly an improvement.

I will wait for Francois and merge, if it is ok for him.

Thanks for all, Harald


nemethi (claiming to be Csaba Nemethi) added on 2025-08-08 15:42:25:

Sorry, forget everything starting with "BTW: ..."!


oehhar added on 2025-08-08 15:32:40:

Thanks for the comment. I have taken this from Androwish: https://androwish.org/home/info/c2b6b889c539e9f7

I suppose, the Title bar height includes the frame...

Or am I missing something stupid?

Thanks for all, Harald


nemethi (claiming to be Csaba Nemethi) added on 2025-08-08 15:10:47:
IMHO, that is a good idea.

BTW: In ::tk::PlaceWindow you have replaced

    incr y -[WMFrameWidth]

with

    incr y -[WMTitleHeight]

This is not quite correct!  It would be more accurate to restore the first statement and then add the second one:

    incr y -[WMFrameWidth]
    incr y -[WMTitleHeight]

oehhar added on 2025-08-08 13:25:44:

Another question:

now we do the following steps:

  1. create the widget
  2. update idletasks
  3. call tk::PlaceWindow with the steps:
    • wm withdraw $w
    • update idletasks
    • wm geometry $w +$x+$y
    • wm deiconify $w

IMHO, the window may be shown for a short period by step 2. Shouldn't there be a "wm widthdraw $w" be inserted before Step 2?

Thanks for all, Harald


oehhar added on 2025-08-08 12:45:42:

Thanks for the great improvement. The message box now is exactly from one border to the next. That is neat, thanks for all.

As accorded (and a bit forced) with Christian and Csaba, I will merge to main when the CI is ok.

Thanks for all, Harald


nemethi (claiming to be Csaba Nemethi) added on 2025-08-04 15:26:38:

The commit [1153477b] eliminates that open point, too.


oehhar added on 2025-08-04 11:31:37:
Christian, Csaba,
thanks a lot for caring !
I really appreciate!

Open point for me:

   *   really place the window at "wm geometry +0".

Thanks for all,
Harald

Attachments: