BWidget

What: BWidget
Where: https://sourceforge.net/projects/tcllib/files/BWidget/ (download)
       https://core.tcl.tk/bwidget/ (issue tracker and source code)
Description: High-level widget set for Tcl/Tk using native Tcl 8.x namespaces.
       Contains over 20 widgets, such as progress bars, main frames,
       generic scrolled widget, paned windows, button boxes, notebooks,
       combo boxes, spin boxes, tree widgets, font and color selection
       widgets, balloon help, and more.
       Original written by Eric Boudallier (cudos, great design)
       Currently at version 1.9.13 .
Updated: 2018-12-06
Contact: https://core.tcl.tk/bwidget/

BWidget is a Tcl/Tk script-only set of megawidgets designed to provide the developer additional tools.

Getting started with BWidget

It is currently being maintained as a part of the tcllib http://tcllib.sf.net/ source code repository. BWidget Reference Manual (HTML documentation) can be found at http://tcllib.sourceforge.net/BWman/contents.html , as well on freshmeat (but that had out of date info there. aku asked to transfer the freshmeat entry to himself and updated the entry to match the current release, available on sf.net.)



See also

Application examples using BWidget: ased. portmon, windows registry browser, DOM related megawidgets, kitten, Tcl Xchange's NetCVS mirror, ramdebugger

Discussion

Zebulon: BWidget Manual with Screenshots


  TWidgets

LV 2008 Mar 25

So, has BWidget been enhanced to take advantage of Ttk when available?

Has there really not been a BWidget release since 2006?

HaO Bugfix release in 2009-07-24 - see [1]. JOB is currently working on a ttk-enabled version.


Has anyone converted the BWidget html reference pages into either doctools or nroff -man formats?

HaO AFAIK - nobody, sorry.


JOB BWidget revitalization:

A modified version for the BWidget toolkit to take advantage of ttk is now available in CVS.

The programming interface of BWidget::use has changed:

# BWidget::use
#   Argument usage:
#      -package ttk
#               |
#               specify a package name to be initialized, currently
#                support for the following packages is implemented:
#                   ttk ... try to use tile'd widget set (if available)
#                
#      -style default / native / myFavoriteStyleName
#             |         |        |
#               |                |         specify a valid style name,
#               |                |         use "BWidget::_get_colordcls" which gives
#               |         |         you a list of what's avaliable for tk
#               |                |
#               |                if specified, BW tries to emulate OS color scheme,
#             |         a specific color schema associated to each individual
#             |         operation system is going to be used
#               |
#             same behaviour as before, stay compatible
#             with previous releases
#         
#      -setoptdb [no=default|0|yes|1]
#                              |
#                              maintain the option database
#                              if you need a dynamic behavior when changing
#                              the underlying style, activate this option!
#
#      -themedirs {} = default / a list of valid directory names,
#                                to specifying additional ttk theme packages

With the modified package (available in CVS) I could get a reasonable good result e.g. for ased3.0b16.vfs by just adding this to the existing code (and copying the requ. theme package to ased.../lib , beside this with no other change!):

    package require BWidget
    BWidget::use \
      -package ttk -style winxpblue -setoptdb 1

The result looks like:

WikiDbImage ased3.0_mod_tile.gif

Comments are welcome!


  BWidget 1.9.2

HaO 2010-06-18 ActiveState has distributed the unreleased BWidget 1.9.1 which contains extended themed support with ActiveTcl 8.4.19.4, 8.5.8.2 and 8.6.0.0b3.

There are some incompatibilities in color selection to former BWidgets. A 1.9.2 release followed which is 1.9.0 with some minor bug fixes. Andreas wrote me, that BWidget 1.9.2 is now installable via Teapot. Anybody experiencing compatibility issues is asked to install this release.

Anybody wanting to use Tile and does not need this compatibility may try to use the 1.9.1 in ActiveState or the current trunk from the Tcllib CVS. This is work in progress.

Mho With version 1.9.1 in Tile mode I see that buttons disappear after they are initially drawn correctly and later activated. The text of the button remains intact. Maybe I have to change more than just specifying BWidget::use -package ttk...:

http://home.arcor.de/hoffenbar/prog/hc_012.jpg http://home.arcor.de/hoffenbar/prog/hc_013.jpg

Only if the mouse pointer is over the button, the relief and border are visible again, but with a different style... See BWidget with tile for a code fragment.

HaO: Sorry, for sure a bug or an unfinished feature. Eventually JOB may write more.


MHo: The BWidget demo coming with ActiveState 8.4.19.4 does not work anymore.

HaO: Does it work with BWidget 1.9.2 for you ?


  TCLLIB CVS

HaO: There are currently two versions of BWidget in the CVS:

  • The Tile-enabled version by JOB (work in Progress) in the Trunk (future BWidget 2.0)
  • The old version with bug-fixes and very limited Tile support with the sticky tag bwidget

A checkout command for the version with the sticky tag bwidget:

cvs -z3 -d:ext:[email protected]:/cvsroot/tcllib checkout -P -r bwidget bwidget

or use the tarball button at the end of [2].


BWidget 1.9.3 release 5th of December 2010

  BWidget Classic and Tile/TTK

I am migrating my own applications to ttk now. There is practically no BWidget widget, which is not replaced by a ttk widget. There are mostly details missing which must be added by additional packets like balloon help (tklib) and drag and drop (tkdnd).

I did not use the work of Johann, because tile is emulated by switching colors. This works well on most Unix platforms but does not bring the complete different look of native windows (and MacOS) widgets. We discussed on that and this approach seams not to be possible. Even a simple ttk::frame may contain a structured bitmap surface which may not be emulated by one color.

I updated the classic BWidget (sticky tag "BWidget" in the repository) within this process. There are tile versions of some widgets which mostly do not support as many options as the normal ones. This is for migration purposes. I would not use it for new projects.

To enable themed mode, use:

Widget::theme 1

Here is the state and thoughts about some widgets:

  • Label: migrated, was quite easy, because ttk::label supports many options.
  • Button: migrated
  • ScrolledWindow: migrated (for ttk::scrollbars and the background frame)
  • NoteBook: this is my favorite BWidget widget which features scroll-buttons compared to the ttk widget. It is difficult to make a tile version. It requires an implementation of the ArrowButton first. I thought making a ttk::frame as background widget on the canvas.
  • ArrowButton: Is required for many widgets. Is implemented as canvas and thus difficult to migrate. One may create a gif with the triangle dynamically and put it on a themed button.
  • Tree: this is a widget many people use but not me.

  BWidget 1.9.4 release 14th of December 2010

Former release has introduced an update bug of multiple nodes in the tree widget, which is fixed here.

MHo 2010-12-16:

  • pkgIndex.tcl is wrong, line 4, says 1.9.3 instead of 1.9.4.

HaO sorry, corrected (also on teapot)

  • with Widget::theme 1 I get an Error in startup script: unknown option "-highlightthickness" while executing "ttk::label .....

HaO What are you doing exactly ? This is correct, this option does not exist any more in themed mode (RTFM?).

  • The download name still says "1.9.2", and only the listbox.tcl seems to be renewed. Is that right?

HaO The only change between 1.9.3 and 1.9.4 is a listbox bugfix, right.


  BWidget 1.9.5 release 27th of june 2011
  • The color picker button is translated, while some languages are still missing.
  • ListBox and tree scroll region on Windows 7
  • ListBox tags for images were broken (introduced in 1.9.2)
  • The widgets LabelEntry, LabelFrame, PagesMgr are now themed (by Wojciech Kocjan).
  • The MainFrame widget got a -sizegrip option. - The NoteBook client frame is themed.

  CLT: Use BWidget for new projects

HaO 2011-08-23 clt contribution by Kevin Walzer on Use BWidget for new projects:

> As I stated on wiki.tcl.tk/bwidget , I would not recomment using > BWidget for new projects if you target ttk (what you should IMHO).

I'd disagree with this. BWidget is still quite useful in certain contexts. Its tree widget is more configurable than the ttk treeview, and the listbox is also more flexible, and yet it is simpler to program against than tktreectrl. Its notebook widget also offers more flexibility than the ttk notebook.

I think the best strategy to use with BWidget is as a supplement--a very powerful one--to the core and ttk widgets. Perhaps you wouldn't want to do an entire project in BWidget, but I find it indispensible and I am grateful that Harald continues to maintain it. That's why I've also contributed some patches to the project and helped test Harald's updates on the Mac.

In case you're curious how I use it, take a look at this screenshot:

http://www.codebykevin.com/packetstream-running.png

The tree widget on the left, styled to emulate a Mac "source list" widget, is a BWidget tree. Doesn't look like the standard BWidget tree in the demos with the Windows-2000-era appearance, but that's the point--these changes are trivial to make. Doing this in tktreectrl would give me a migraine, and I'm not aware that the ttk treeview can be configured to this extent.


  CLT discussion about mousewheel

HaO 2011-03-22: The following thread gives valueable input by Martyn Smith and Koen Dankaert:

http://groups.google.com/group/comp.lang.tcl/browse_thread/thread/afa34a966e4bbe83#

This is also a reminder (for me) that there is action pending.


  BWidget 1.9.6 release 27th of july 2012

The 4 bug-fixes of this year are included in this release:

  • ListBox selection only redrawn if changed
  • Entry configure in themed mode fixed
  • error if next widget is a ttk widget and has spaces in the window path
  • ListBox documented options -selectfill and -autofocus as read-only

Download


  Repository of source code moved to fossil

2013-01-14: Thanks to Roy Keene, the repository of the source code moved to https://core.tcl.tk/bwidget/home


  BWidget 1.9.7 release 15th of september 2013

New features of 1.9.7:

  • Allow new modifiers Shift, Cmd and ShiftCmd for menu accelerators, which is specially useful for the MAC.
  • xpm-to-image accepts a wider range of xpm dialects
  • Make loadable in save interpreter.
  • Add method getentry to ComboBox to facilitate bindings on widget

Download


2013-10-15: Wolfgang S. Kechel wrote about BWidget ComboBox (which now has themed colors (1.9.8)):

ttk::combobox is not a replacement for BWidget::ComboBox as it does not support images.


  BWidget 1.9.8 release 9th of september 2014

New features of 1.9.8:

  • New procedure Widget::which to get fully qualified name of widget or option
  • Make -constrainedwidth 1 and -constrainedheight 1 work together for scrollframe.
  • Themed ComboBox color specifications are honored.

Download


  How to commit on fossil

HaO 2015-10-06: I was asked how to update bwidget on fossil. Well, the current development is in branch bwidget.

Here is my recipe:

  • create a folder where you put the repository file and get the repository with the correct login, so you need it only once and not again. This is crucial to set the login here and not later in the gui etc.
cd test
mkdir repo
cd repo
fossil clone http://adrianmedranocalvo:[email protected]/bwidget bwidget.fossil
  • You may switch off autosync
fossil ui bwidget.fossil
-> Admin->Settings->autosync

(no login etc, this works automatically)

  • checkout in folder c:\test\repo
cd c:/test
mkdir checkout
cd checkout
fossil open ../repo/bwidget.fossil bwidget
  • Apply your changes
  • check changes
fossil diff --tk
  • commit changes to local repository (if autosync is off)
fossil commit
-> Enter comment, use [xxxxx] to reference tickets
  • check if all ok:
fossil ui
  • If not ok you may restart at the beginning. I personally always have a copy of the repo. If I made something stupid, I delete everything and restart.
  • commit to server
fossil sync

BWidget 1.9.10 released 8th of march 2016

This is the release comming with TCL8.6.5, TCL8.5.19. The enhancements are:

  • lang rc files now in utf-8 encoding
  • multiple screens with different sizes supported for bubble help placement
  • and some corrected bugs mainly fixing visual issues

The lang file encoding change increases portability when the system encoding is not an iso-latin derivate. Due to that, the update is recommended. This Tk Ticket 0a3d799a6d tells the whole story.


BWidget 1.9.11 released 25th of August 2017

Bugfix release. See readme for details.

---

BWidget 1.9.12 released 10th of January 2018

Two new features:

  • notebook tab may have an image
  • color chooser dialog has a numeric entry, help and new section layout

---

BWidget 1.9.13 released 6th of December 2018

small maintenance:

  • dialog.c: For Unix, also Bind KP_Enter for default dialog button invokation.
  • spanish translation enhanced

---

Use menubutton with BWidget MainFrame Widget

This is sort of a hack and does not comply to the quality of BWidget. Nevertheless, it was helpful for me to have the same Menu on AndroWish and PC program.

Here is the sketch:

# Menu
# The first level is empty to have items like commands or checkboxes at the top level.
set menuItems [list "" {} {} 0\
        [list command &ExampleLabel {} "Press me" "" -command ShowMe]]

# Create MainFrame with empty menu
if {$fAndroid} {set TopMenu ""} else { set TopMenu $menuItems }
MainFrame .fm -separator none -menu $TopMenu
pack .fm -fill both -expand yes
set clientFrame [.fm getframe]
# Menue bar frame
pack [ttk::frame $clientFrame.mf] -side bottom -fill x
if {$fAndroid} {
    ttk::menubutton $clientFrame.m
    MainFrame::_create_menubar .fm $menuItems $clientFrame.m
    pack $clientFrame.m -in $clientFrame.mf
    raise $clientFrame.m $clientFrame.mf
}