Bwidget Source Code
View Ticket
Not logged in
Ticket UUID: 8edade3cea00249959cba7c91db80750db7c7084
Title: Incorrect use of options in MessageDlg
Type: Bug Version: 1.9.10
Submitter: anonymous Created on: 2017-05-03 09:42:53
Subsystem: bwidget 1.x Assigned To: oehhar
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2017-05-08 18:23:23
Resolution: Fixed Closed By: oehhar
    Closed on: 2017-05-08 18:23:23
Description:
BWidgets does not honor options -width, -aspect and -font in the documented way.

Findings:
Very old discussion: https://groups.google.com/forum/#!topic/comp.lang.tcl/tIJfzg0cWPs
More specific aspect/width: http://stackoverflow.com/questions/4658615/problem-with-bwidgets-messagedlg

In messagedlg.tcl native tk_messageBox is called which does not support -font.
 $ grep -n messageBox /usr/share/tcltk/bwidget1.9.10/messagedlg.tcl 
 111:	# Do some translation of args into tk_messageBox syntax, then create
 112:	# the tk_messageBox
 123:	set res [eval [list tk_messageBox] [array get tkMBoxArgs]]

Used test script:
 puts "BWidget [package require BWidget]"
 set msg "This is a rather long text for testing the BWidget's"
 append msg " MessageDlg behavior using aspect, width and font options"
 append msg " using TCL [info patchlevel] on Debian Linux"
 MessageDlg .msgDlg -title "Dialog title text" -type ok \
    -icon info -width 200 -aspect 50 -font "Courier 10"\
    -message $msg

Neither width nor aspect nor font is affected when changing one of the options. 

But if "-type user" is defined the corresponding options seem work (not tested careful). This type uses BWidget's "Dialog" for settion up the dialog box and the "-font" is not documented in the BW-manual (at least not in 1.9.8).       
   if { $type == "user" } {
...
      eval [list Dialog::create $path] $maps(:cmd)
... 
   } else {
... 
      set res [eval [list tk_messageBox] [array get tkMBoxArgs]]

Modified test call for type user: 
 MessageDlg .msgDlg -title "Dialog title text" -type user -buttons "ok cancel" \
    -icon info -width -200 -aspect 50 -font "Courier 10 italic"\
    -message $msg 

IMHO updating the documentation and  would be sufficient. Especially the "-width" option seems to define a maximum value only and not a fixed size.
User Comments: oehhar added on 2017-05-08 18:23:23: (text/x-fossil-wiki)
Documentation updated by commit [66e9c7802d].
Hope this is ok so directly closing ticket.

Thanks,
Harald

oehhar added on 2017-05-03 10:05:34: (text/x-fossil-wiki)
Thank you, Gerhard, for the ticket.

Eventually this was introduced by a change in Tk when Tk changed from own to native widgets (on windows).

IMHO a wrapper for standard Tk functionality with no additional value is not useful.

But I agree, documenting what is happening is a good step.

Thank you,
Harald