how to create a "modeless" dialog - so that the script goes on its
merry way, while the dialog sits there .
Thank you! Mark
Here's one way:
console show
toplevel .y
label .l -text "This is my main window, which is not involved in the
modeless dialog box"
grid .l
button .y.b1 -text "Here" -command {set ::ach(1) 1 }
button .y.b2 -text "There" -command {set ::ach(2) 2 }
array set ::ach { 1 0 2 0 }
trace variable ::ach w ::florg
proc florg { args } {
puts "florg <$args>"
parray ::ach
}
grid .y.b1 .y.b2 -sticky news
-----
Output looks like:
florg <::ach 1 w>
::ach(1) = 1
::ach(2) = 0
florg <::ach 2 w>
::ach(1) = 1
::ach(2) = 2
florg <::ach 1 w>
::ach(1) = 1
::ach(2) = 2
(modelessdialog) 1 %
-------
Within proc "::florg", you now get mapped button events
whenever each button is selected. This without resorting
directly to events on the buttons themselves.
You can do similar things with entry fields, the "-variable"
option therein and trace of that as well. And there are
other ways.
--
Les Cargill
Well, you start with a toplevel (just like a modal dialog):
toplevel .whatever
wm transient .whatever .
and you go from there.
The only difference from a modal dialog and a modeless dialog is whether
or not you use the 'grab' command on it.
>
> Thank you! Mark
>
--
Robert Heller -- 978-544-6933
Deepwoods Software -- Download the Model Railroad System
http://www.deepsoft.com/ -- Binaries for Linux and MS-Windows
hel...@deepsoft.com -- http://www.deepsoft.com/ModelRailroadSystem/
Thank you Robert too! I appreciate
Mark,
Others have point you down the path of how to do what you want.
I want to point you down the path to enlightenment...
Other toolkits give you lots of specific widgets to do specific things. The
problem comes in if you can not find a widget that does exactly what you
want. In most cases you either have to change what you want or do a *lot*
of work (many times at a very low level).
Tk takes a different approach, it gives you components that you can put
together to do whatever you want it to do.
For example, Tk does not have a X/Y scrolled listbox. What we have is a
listbox and a scrollbar widget that can be combined easily to make:
1) a X/Y scrolled listbox
2) a Y only scrolled listbox
3) a X only scrolled listbox
3) an unscrolled listbox
The same concept (and normally option) can then be used to make many (but
not all) other widgets scroll.
--
+------------------------------------------------------------------------+
| Gerald W. Lester |
|"The man who fights for his ideals is the man who is alive." - Cervantes|
+------------------------------------------------------------------------+
>
> Thank you very much - this got me started in the right direction!
>
> Thank you Robert too! I appreciate
Have a look at dialog.tcl in the Tk library directory. One can just
copy this file, change the proc name and remove sections 7 and 8 (which
deal with the grabbing, waiting, and ungrabbing), and presto, a
modeless dialog!