Menu

#2238 tk_messageBox does not display -detail argument correctly

obsolete: 8.5a5
closed-fixed
5
2007-08-01
2007-04-02
No

On Windows XP (SP2) the following Tk command displays a dialog with the "detail" followed by a string of random characters.

tk_messageBox -message Hello -detail "Pleased to meet you"

The following command, with a longer "detail" argument, displays correctly.

tk_messageBox -message Hello -detail "Pleased to meet you and your kin"

Discussion

  • Alastair Davies

    Alastair Davies - 2007-04-02

    Logged In: YES
    user_id=988604
    Originator: YES

    Version involved is:

    % package require ActiveTcl
    8.5.0.0.272633

     
  • Alastair Davies

    Alastair Davies - 2007-04-02
    • summary: tk_messageBox requires minimum length of -details argument --> tk_messageBox does not display -detail argument correctly
     
  • Alastair Davies

    Alastair Davies - 2007-04-02

    Logged In: YES
    user_id=988604
    Originator: YES

    Actually, it's not so simple. The lengths of the "detail" that are displayed correctly and the lengths of the "detail" that have some garbage appended are intimately interspersed.

    set detail ""
    for {set i 0} {$i<60} {incr i} {
    append detail [string index $i end]
    tk_messageBox -message Count -detail $detail
    }

    I'm not even convinced it only depends on the length. But it's not right, anyhow.

     
  • Adrian Robert

    Adrian Robert - 2007-07-31

    Logged In: YES
    user_id=146959
    Originator: NO

    I see this on 8.5a6, Windows XP SP2 as well, compiled from source. Seems almost like it axes the terminating '\0' in the detail string before display.

     
  • Adrian Robert

    Adrian Robert - 2007-07-31

    Logged In: YES
    user_id=146959
    Originator: NO

    Update: this relates to win/tkWinDialog.c:2146. Tcl_DStringAppend() is given a length argument there, Tcl_DStringLength(&detailString). Changing this to "Tcl_DStringLength(&detailString)+1" APPEARS to fix the problem. (Using "-1" does not.) I'm not an expert regarding DStrings, 16-bit unicode, termination, and Windows peculiarities, but some interaction between these is at fault.

     
  • Pat Thoyts

    Pat Thoyts - 2007-08-01
    • status: open --> closed-fixed
     
  • Pat Thoyts

    Pat Thoyts - 2007-08-01

    Logged In: YES
    user_id=202636
    Originator: NO

    Changed to code to avoid this problem and extended to test suite to check for this issue in the future.