Tk Library Source Code

View Ticket
Login
Ticket UUID: 688227
Title: Notebook left side not drawn (0 borderwidth)
Type: Patch Version: None
Submitter: lewca43 Created on: 2003-02-17 20:20:33
Subsystem: bwidget Assigned To: hobbs
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2003-05-15 06:50:07
Resolution: Fixed Closed By: hobbs
    Closed on: 2003-05-14 23:50:07
Description:
In a NoteBook widget, if the canvas has 0 borderwidth
(perhaps set by option database), the left side of the
notebook will be drawn at -1 x coordinate and will not
be visible. This patch fixes that by never allowing the
left side to be drawn at an x coordinate that is negative.

This bug was found in the bwidget1.5 distribution as
released with ActiveTcl 8.4.1

- Bryan Schofield
User Comments: hobbs added on 2003-05-15 06:50:07:
Logged In: YES 
user_id=72656

Corrected by always checking that bd is 1 when used, 
although it might be better to force that in the configure.

hobbs added on 2003-05-15 06:41:43:
Logged In: YES 
user_id=72656

This appears to be an error lower in the notebook code.  The 
notebook already restricts the -bd option to [1..2], but 
obviously not at creation time.

lewca43 added on 2003-03-01 05:48:36:
Logged In: YES 
user_id=299572

Here's an example that illustrates the problem. Note that even 
though I am using Tclkit, the problem exists in plain old wish.

> tclkit
% parray tcl_platform
tcl_platform(byteOrder) = bigEndian
tcl_platform(machine)   = sun4u
tcl_platform(os)        = SunOS
tcl_platform(osVersion) = 5.8
tcl_platform(platform)  = unix
tcl_platform(user)      = bschofie
tcl_platform(wordSize)  = 4
% puts $tcl_patchLevel
8.4.1
% package require Tk
8.4
% file tail [pwd]
bwidget
% lappend auto_path .
/homes/bschofie/bin/tclkit/lib/tcl8.4 /homes/bschofie/bin/tclkit/l
ib /homes/bschofie/bin/tclkit/lib/tk8.4 .
% package require BWidget
1.5
% option add *Canvas.borderWidth 0
% pack [NoteBook .n] -fill both -expand 1 -padx 2 -pady 2
% .n insert end a ; .n raise a
a

The  result will be that the left side of the notebook is not 
visible because it is drawn at -1 x coordinate. The canvas 
could adjust its viewport or just make sure it doesn't draw 
anything past 0. I found this problem because I use the option 
data base heavily in all my applications to maintain a 
consistent (more profesional, imo) look. Since I 
think "*BorderWidth: 1" produces a nice look I use that, but 
some widgets do better with no borderwidth by default. For 
example, frame and canvas widgets usaully need 0 
borderwidth to prevent small offsets in alignment. Thus the 
need for *Canvas.borderWidth: 0 option.

By the way, there are also minor rendering issues when the 
borderwidth is somthing larger than 2... but who want that? :-)

- Bryan Schofield

hobbs added on 2003-02-25 17:18:56:
Logged In: YES 
user_id=72656

Can you please post a script that shows the visual 
irregularity?  I believe that 'canvas xview moveto 0' or the like 
might be more appropriate.

lewca43 added on 2003-02-18 03:23:53:

File Added - 42698: notebook.left-side-not-drawn.patch

Attachments: