Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

bwidget newbie

14 views
Skip to first unread message

tclt...@aol.com

unread,
Apr 21, 2007, 3:59:23 AM4/21/07
to
I'm looking for bwidget examples or perhaps tutorial. I tried reading
the manual. For example the combobox has this details. But I can't
make out how to create a combobox. I cna't find any examples. Please
help.

NAME
ComboBox - ComboBox widget
CREATION
ComboBox pathName ?option value...?
OPTIONS from ArrowButton
-background or -bg -disabledforeground
-foreground or -fg -state

OPTIONS from Entry
-command -disabledforeground
-dragenabled -dragendcmd
-dragevent -draginitcmd
-dragtype -dropcmd
-dropenabled -dropovercmd
-droptypes -editable
-entrybg (see -background) -entryfg (see -foreground)
-exportselection -font
-helptext -helptype
-helpvar -highlightbackground
-highlightcolor -highlightthickness
-insertbackground -insertborderwidth
-insertofftime -insertontime
-insertwidth -justify
-selectbackground -selectborderwidth
-selectforeground -show
-state -takefocus
-text -textvariable
-width -xscrollcommand

WIDGET-SPECIFIC OPTIONS
-autocomplete -autopost
-bwlistbox -expand
-height -hottrack
-images -listboxwidth
-modifycmd -postcommand
-values

WIDGET COMMAND
pathName bind ?arg...?
pathName cget option
pathName clearvalue
pathName configure ?option? ?value option value ...?
pathName get
pathName getlistbox
pathName getvalue
pathName icursor index
pathName post
pathName setvalue index
pathName unpost

Aric Bills

unread,
Apr 21, 2007, 5:36:42 AM4/21/07
to
Here's a fairly minimal example:

package require BWidget

set cb [ComboBox .cb \
-values [list one two three] \
-editable 1]
grid $cb

Depending on what you're trying to accomplish, you might also consider
using a menubutton to do the job. Also worth noting is that Tile also
provides a combobox widget:

package require tile

set cb [ttk::combobox .cb \
-values [list one two three]]
grid $cb

The Tile and BWidgets comboboxes have overlapping but different
functionality, and different appearances. See the manual pages and/or
ask follow-up questions here for help deciding which to use.

tclt...@aol.com

unread,
Apr 21, 2007, 6:01:34 AM4/21/07
to

Thanks. Here is were my confusion lies. Quoting the manual on
combobox:

-height
Specifies the desired height for the window, in lines. If zero or
less, then the desired height for the window is made just large enough
to hold
all the elements in the listbox.

Why is the combobox widget referred to as window? Coming from MS
Windows programming environment, this is very confusing for me.


Aric Bills

unread,
Apr 21, 2007, 6:42:52 AM4/21/07
to
On Apr 21, 2:01 am, tcltk...@aol.com wrote:
> Thanks. Here is were my confusion lies. Quoting the manual on
> combobox:
>
> -height
> Specifies the desired height for the window, in lines. If zero or
> less, then the desired height for the window is made just large enough
> to hold
> all the elements in the listbox.
>
> Why is the combobox widget referred to as window? Coming from MS
> Windows programming environment, this is very confusing for me.

In Tk-speak, we talk about toplevel windows vs. other windows. The
kind of window one tends to think of in conjunction with MS Windows is
the toplevel kind.

I'm not sure I can articulate a difference between "widget" and
"window"; maybe "window" is used more frequently to refer to the space
taken up on the screen, relative positions between gui objects
(including the mouse pointer),

Aric Bills

unread,
Apr 21, 2007, 6:55:17 AM4/21/07
to
> In Tk-speak, we talk about toplevel windows vs. other windows. The
> kind of window one tends to think of in conjunction with MS Windows is
> the toplevel kind.
>
> I'm not sure I can articulate a difference between "widget" and
> "window"; maybe "window" is used more frequently to refer to the space
> taken up on the screen, relative positions between gui objects
> (including the mouse pointer),

...Don't you hate it when you push the "send" button accidentally?

Anyway, "widget" might be used more frequently when talking about a
gui object in terms of functionality or behavior.

I think the bottom line is that if you're unsure how to interpret
something in the documentation, the best thing to do is to start an
interactive Wish session and just type commands and see what they do.
Create a combobox with a specific -height and then re-configure the
height and see what changes:

package require BWidget
set cb [ComboBox .cb -height 6 -values {a b c}]

Then type:

$cb configure -height 2

It turns out that -height controls the height of the drop-down menu
portion of the combobox. This could have been made more clear in the
man page. You could submit a documentation bug report (to the tcllib
project at sourceforge); preferably, you should submit a more clear
version of the confusing paragraph.

Robert Heller

unread,
Apr 21, 2007, 7:54:18 AM4/21/07
to

package require Tk
package require BWidget

pack [LabelFrame .lframe -text {Pick a fruit:}] -fill x
set cb [ComboBox [.lframe getframe].combo \
-values {Apples Oranges Pears Strawberrys Bannas} \
-editable no]
pack $cb -fill x -side left
$cb setvalue first
set but [Button [.lframe getframe].button -text "Eat it" \
-command "EatFruit $cb"]
pack $but -side right

proc EatFruit {cb} {
tk_messageBox -type ok -icon info -message "Yummy [$cb cget -text]"
}

>
>

--
Robert Heller -- 978-544-6933
Deepwoods Software -- Linux Installation and Administration
http://www.deepsoft.com/ -- Web Hosting, with CGI and Database
hel...@deepsoft.com -- Contract Programming: C/C++, Tcl/Tk

Robert Heller

unread,
Apr 21, 2007, 7:54:18 AM4/21/07
to

The base primitive thing that takes up screen space under low-level X11
(the UNIX primitive graphics subsystem layer) is a window. This is
irrespective of whether it is a 'toplevel' window or not (X11 makes no
distintion). 'Widgets' are windows that do something more than just
sit there, that is, a widget is a window with a behaviour of some sort.
Widgets are implements at a layer above bare X11 in some sort of GUI
Toolkit (Xt, Xaw, Motif, Tk, Qt, GTK, etc.).

MS-Windows does not have this 'layered' (modular) approach. Its
equivalent of X11 (primitive graphics subsystem) and GUI Toolkit is all
'mushed' into a single layer.

Glenn Jackman

unread,
Apr 21, 2007, 10:58:26 PM4/21/07
to
At 2007-04-21 03:59AM, "tclt...@aol.com" wrote:
> I'm looking for bwidget examples or perhaps tutorial. I tried reading
> the manual. For example the combobox has this details. But I can't
> make out how to create a combobox. I cna't find any examples. Please
> help.

Check out the BWidgets demo. If you can't find it on your system, it's
also here: http://tcllib.cvs.sourceforge.net/tcllib/bwidget/demo/

--
Glenn Jackman
"You can only be young once. But you can always be immature." -- Dave Barry

Donal K. Fellows

unread,
Apr 22, 2007, 3:52:19 AM4/22/07
to
Robert Heller wrote:
> The base primitive thing that takes up screen space under low-level X11
> (the UNIX primitive graphics subsystem layer) is a window.

Yes, and a widget is the representation of a window in a higher-level
library called a toolkit. The higher-level library adds things like
default behaviours, e.g. so that the window is redrawn when necessary
(pretty much all that a frame widget does) or responds to mouse clicks
(needed for button widgets and more). To see what would happen if you
didn't have all that extra behaviour added, you can use a little known
(mis?)feature of Tk[*], and create a toplevel with a background that
is the empty string. Drag the toplevel around, drag other windows over
the top of it, etc. and see how the window accumulates bits and pieces
of whatever else is going on on the display.

> MS-Windows does not have this 'layered' (modular) approach. Its
> equivalent of X11 (primitive graphics subsystem) and GUI Toolkit is all
> 'mushed' into a single layer.

I think you're wrong there. It's just that the distinction on that
platform is between parts that are implemented in a low-level DLL
versus a high-level one. And the terminology is different, of course.
(And I think Win uses more gadgets - in X11 terminology - in native
apps, which are widgets without a window. As a reference point, OSX
uses all gadgets except for toplevels; it's a platform that is quite
different to X11, much more so than Windows.)

Donal.
[* Actually, the feature is necessary when you've got two toolkits
wanting to manage the same window; video playback is the most common
example of this. ]

tclt...@aol.com

unread,
Apr 22, 2007, 4:57:22 AM4/22/07
to
On Apr 22, 8:52 am, "Donal K. Fellows" <donal.k.fell...@man.ac.uk>
wrote:

Now I know. Thanks to everyone here. Your posts have been very helpful
but I'll be coming back for more.

Robert Heller

unread,
Apr 22, 2007, 8:42:19 AM4/22/07
to
At 22 Apr 2007 00:52:19 -0700 "Donal K. Fellows" <donal.k...@man.ac.uk> wrote:

>
> Robert Heller wrote:
> > The base primitive thing that takes up screen space under low-level X11
> > (the UNIX primitive graphics subsystem layer) is a window.
>
> Yes, and a widget is the representation of a window in a higher-level
> library called a toolkit. The higher-level library adds things like
> default behaviours, e.g. so that the window is redrawn when necessary
> (pretty much all that a frame widget does) or responds to mouse clicks
> (needed for button widgets and more). To see what would happen if you
> didn't have all that extra behaviour added, you can use a little known
> (mis?)feature of Tk[*], and create a toplevel with a background that
> is the empty string. Drag the toplevel around, drag other windows over
> the top of it, etc. and see how the window accumulates bits and pieces
> of whatever else is going on on the display.
>
> > MS-Windows does not have this 'layered' (modular) approach. Its
> > equivalent of X11 (primitive graphics subsystem) and GUI Toolkit is all
> > 'mushed' into a single layer.
>
> I think you're wrong there. It's just that the distinction on that
> platform is between parts that are implemented in a low-level DLL
> versus a high-level one. And the terminology is different, of course.

OK, I know next to nothing about MS-Windows. :-). My point is that the
different 'layers' are not as clear and distint in the sense that from
an API point of view they are in separate libraries and at the toolkit
(widget/gadget) level there is an 'assortment' of *different* packages,
each with its own behaviours, libraries, headers (API). Under
MS-Windows the layers are not so clearly separated.

> (And I think Win uses more gadgets - in X11 terminology - in native
> apps, which are widgets without a window. As a reference point, OSX
> uses all gadgets except for toplevels; it's a platform that is quite
> different to X11, much more so than Windows.)
>
> Donal.
> [* Actually, the feature is necessary when you've got two toolkits
> wanting to manage the same window; video playback is the most common
> example of this. ]
>
>

--

Larry W. Virden

unread,
Apr 23, 2007, 12:48:46 PM4/23/07
to
On Apr 21, 3:59 am, tcltk...@aol.com wrote:
> I'm looking for bwidget examples or perhaps tutorial. I tried reading
> the manual. For example the combobox has this details. But I can't
> make out how to create a combobox. I cna't find any examples.

Several things to mention. The docs for bwidget items tends to follow
a style somewhat similar to Tk. If you are not yet comfortable working
with Tk, learning more about it may help understanding.

I suspect if you browse http://wiki.tcl.tk/bwidget , you should find
pointers to examples and tutorials.

I'm not certain where one might find truly up to date tutorials on Tk
8.5 that also covers Tile. That is going to be the upcoming
development platform of choice, due to the improvement in look, etc.
You might investigate though, to see what you can find. Perhaps
someone has been working on some tutorial information at one of the
universities, etc.

0 new messages