HDTenEightyP/NetNews huggingface dataset:
From: faustus@ygdrasil.CS.Berkeley.EDU (Wayne A. Christopher)
Newsgroups: comp.lang.tcl
Subject: Re: Scrollable buttons?
Date: 17 Nov 1992 19:15:39 GMT
Organization: University of California, Berkeley
NNTP-Posting-Host: ygdrasil.cs.berkeley.edu

In article <1992Nov17.151657.3467@cis.ohio-state.edu> mdm@stegosaur.cis.ohio-state.edu (Michael Moore) writes:

[ A bunch of code to make a frame with a canvas and a scrollbar... ]
> for {set i 0} {$i < 25} {incr i} {
>    button .frame.canvas.button$i  \
>	-relief raised \
>	-text "Button $i"
>    .frame.canvas create window 40 [expr $i*25] \
>	-window .frame.canvas.button$i 
> }

The problem here is that you have to know the size of the buttons
beforehand.  Could you do the following?  (I haven't tried it but I
will.)

- make a canvas with a scrollbar
- put a frame somewhere in the canvas
- pack all the buttons in the frame
- see how big the frame is
- set the canvas scroll region appropriately

Has anybody written a scrolled frame?  That ought to be an easy widget
to write.  (I know, why don't I write it...)

	Wayne
From: ouster@sprite.Berkeley.EDU (John Ousterhout)
Newsgroups: comp.lang.tcl
Subject: Re: couldn't allocate a color for "#ffe4c4"
Date: 20 Nov 1992 16:32:42 GMT
Organization: U.C. Berkeley Sprite Project
Distribution: world
NNTP-Posting-Host: tyranny.berkeley.edu

In article <1992Nov19.025858.15521@bnr.ca>, scoob@bnr.ca (Christian Marcotte) writes:
|> 
|> 
|> So this is my first Tk application.
|> Tk is the best thing since chocolate but I still have this little problem
|> when running my tk application on my color machine when I already a very
|> colorful background...
|> 
|>    couldn't allocate a color for "#ffe4c4"
|> 
|> Any ideas on how I could avoid that?
|> 
|> Thanks.
|> 
|> -- scoob
|> 
|> 
|> -- 
|> ---------------------------------------------------------------------------
|> Christian Marcotte                Bell-Northern Research
|> scoob@bnr.ca                      3500 Carling Ave
|> Telephone: (613) 763-2782         Nepean, Ont., Canada K1Y 4H7

Tk 2.3 doesn't handle color exhaustion very gracefully.  This code has
been reworked and will behave more gracefully in the next Tk release.
Newsgroups: comp.lang.tcl
From: davis@cs.cornell.edu (Jim Davis)
Subject: Can I operate on windows not created by tk?
Organization: Cornell Univ. CS Dept, Ithaca NY 14853
Distribution: usa
Date: Wed, 18 Nov 1992 21:00:08 GMT

I would like to be able to operate on windows created by other
applications besides tk.  In particular, what I want to do is grab
bitmaps from those windows, something like what xwd or the Open
Windows snapshot tools do.  

I daresay I'll have to write new tk commands to get those bits,
(anyone done that?).  It is pretty easy to grab the mouse and get an
XY position in the root coordinate frame, but what do I do next?  I
don't see any way to find the window at those coordinates.  The
window manager (twm) must know, but how can I ask it anything?


Newsgroups: comp.lang.tcl
From: gwj@sbctri.sbc.com (Gregg W. Jensen)
Subject: possible canvas help
Organization: Southwestern Bell Technology Resources, St.Louis, MO
Date: Thu, 19 Nov 92 14:02:20 GMT


For all the tk gurus...
I need to have a picture of a map laid out in a window (a canvas one?) and be
able to place points on top of the map with lines between the points.  Next
I need to be able to click on the line and bring up say another window with 
info about what the line represents.  Also, I need to click on the points and
have them bring up another window that may be another picture representation
of what the point represents.  My initial gut feel is to use the canvas widget
and draw the things on it (I haven't used tk in this way so maybe I am missing
something).  I would like to get some pointers on how this might be
accomplished (source code for something similar would be wonderful).

Thanks, Gregg
---
This is a new address for me so if mail bounces try to send it to:
gj9362@smaug.sbc.com or gj9362%smaug.sbc.com@texbell.sbc.com
Newsgroups: comp.lang.tcl
From: mathew@elroy.Jpl.Nasa.Gov (Mathew Yeates)
Subject: polling, nonblocking reads in tcl
Organization: Image Analysis Systems Group, JPL
Date: Sat, 21 Nov 1992 21:27:26 GMT

Im having trouble with the following. I set a up telnet connection
and want to read by polling the pipe and responding to input. Here
is a code fragment (I'm using extended tcl)
-----------------------------------------------------------------------
set valkcon [open "|/usr/ucb/telnet valkyries.andrew.cmu.edu 5000" w+]
fcntl $valkcon NDELAY 1

set motd ""
while {1} {
set ready [lindex [select $valkcon {} {} 0] 0]
	if {[llength $ready] != 0} {
                set onechar [read $ready 1]
                append motd  $onechar
                .t insert end $onechar
                update

                if {[string match {*Enter Login :*} $motd] != 0} {
                set motd ""
                break
                } else {}
        }
}
---------------------------------------------------------------------

Problems:
1) If I try and read much more than 1 byte, the program bombs with an
"Operation would block". Ive tried catching this by replacing the
read line with catch {set onechar [read $ready 100]} but in this case
when an exception occurs, onechar is not set so the next line gives an
error. Ive also tried not setting fcntl but, in this case, the program
seems to hang for long periods of time. This may be related to problem 2.

2) It seems that the input is being buffered. Is this a consequence of
the Tcl command "read" being built on top of fread instead of read?
Often times, the program will hang at the select call as if there is
no impending input (even though I know it is there). If I force some
characters through the telnet connection, then the missing characters
show but the ones I just sent do not. In other words, there is a delay.

Any clues?

Thanks in advance,
Mathew 
Newsgroups: comp.lang.tcl
From: tdoan@bnr.ca (Tuan Doan)
Subject: Localizing pick item in list widget?
Keywords:  List, selected, item, TCL/TK, localized
Organization: Bell-Northern Research, Richardson, Tx.
Date: Sun, 22 Nov 1992 21:29:45 GMT

Hello,

   When an item in a list widget is selected and the user has to select an
item in another list widget, the item in the first list widget gets unselected.
When the second list is destroyed does TK allow a way to reselect the item
that was selected in the first list?  What I am looking for is somesort of
localized selection.  If anyone know the answer to this, please Email.

Thanks,

 __  __/  /   /   __  /    |   /    Tuan T. Doan
    /    /   /   /   /   / |  /     Advance Signalling Design
   /    /   /   __  /   /  | /      2201 Lakeside Blvd.  P.O. Box 833871
__/  ______/ __/ __/ __/  __/       Richardson, TX 75083-3871
                                    Phone: 6-444-4575/214-684-4575
Internet:  tdoan@bnr.ca             Fax:   6-444-3716/214-684-3716
      or   tdoan@x400gate.bnr.ca    
Newsgroups: comp.lang.tcl
From: Duane Murphy <damurphy@wc.novell.com>
Subject: Aborting command interpreting
X-Xxdate: Thu, 19 Nov 92 17:39:34 GMT
Organization: Novell, Inc.
X-Useragent: Nuntius v1.1.1d12
Date: Thu, 19 Nov 1992 17:35:22 GMT

I am looking for a clean way of being able to abort the Tcl interpreter 
while it is interpreting a script.  I have looked at CreateTrace, but 
there does not seem to be a way of telling the interpreter to stop 
interpreting.  I have been able to do this by hacking Tcl_Eval, but I 
would like a clean way of doing this.  

I have thought of some cheating ways that involve using the internal 
structure of the interpreter and not the publish public structure.

The idea is to have a clean way of aborting exceptionally long scripts or 
(heaven forbid) a script that has an (non-recursive) endless loop. The 
idea would be to force the execution of a particular command to return an 
error.  This (usually) causes the script to stop.

Any ideas, comments, suggestions?

...Duane
Organization: Carnegie Mellon, Pittsburgh, PA
Newsgroups: comp.lang.tcl
Date: Fri, 20 Nov 1992 14:17:13 -0500 
From: Sean.Levy@cs.cmu.edu
Subject: Re: Tk and Macintosh?

Excerpts from netnews.comp.lang.tcl: 19-Nov-92 Re: Tk and Macintosh?
"David Herron"@twg.com (2824)

> - Write a native implementation of Xlib.  This by itself would be a big
>   project, but once done Tk would have instant portability to that
>   system.

>   Fortunately we didn't need to write our own Xlib as we've found one
>   for DOS.  Unfortunately it's been taking awhile to port that Xlib
  to the compiler we have on DOS.

This seems by far the most preferable solution in the short term to me. 
Clearly, the MacX server has to have code in it somewhere to translate X
protocol requests to Macintosh calls (ddx or whatever they call it now).
It's actually surprising to me that I haven't heard of Apple.COM
splitting this functionality out and packaging it with a normal Xlib API
(of course, this is harder than I just made it sound) -- they'd make a
killing, wouldn't you think? Esp. from folks like us...

Sigh.

			-- Sean
--
Sean Levy, n-dim Group, EDRC, CMU, 5000 Forbes Ave, PGH, PA 15213
Email: snl+@cmu.edu, Phone: +1 412 268 5221, Fax: +1 412 268 5229
              -=- MIME email cheerfully accepted -=-
Newsgroups: comp.lang.tcl
From: lwv26@cas.org (Larry W. Virden)
Subject: Re: Tk and Macintosh?
Followup-To: comp.lang.tcl
Reply-To: lvirden@cas.org (Larry W. Virden)
Organization: Nedriv Software and Shoe Shiners, Uninc.
Date: Fri, 20 Nov 1992 19:37:22 GMT

Note that Tk and Tcl are already present on the Mac in some fashion.

Here are 3 folks who have done something with it so far!

What: Alpha (Alpha 5.0)
Where: cs.rice.edu
Description: Macintosh System 7.0 shareware ($25) Tcl programmable editor.
Contact: pete@cs.rice.edu

What: MacOS Tcl (tcl61.cpt.bin)
Where: barkley.berkeley.edu
Description: Tcl6.1 Mac port (ThinkC 5.0.1)
Contact: parag@netcom.com (Parag Patel)

What: tickle (version 3.1v1)
Where: ftp.msen.com:pub/vendor/ice
Description: a Macintosh utility for file conversions - handles binhex,
		uudecode, compress, tar, MacBinary, Apple Single/Double, etc.
Contact: tickle@ice.com

-- 
Larry W. Virden                 UUCP: osu-cis!chemabs!lvirden
Same Mbox: BITNET: lvirden@cas  INET: lvirden@cas.org
Personal: 674 Falls Place,   Reynoldsburg, OH 43068-1614
Newsgroups: comp.lang.tcl
From: jkimball@src.honeywell.com (John Kimball)
Subject: evalling a string
To: comp.lang.tcl
Posted-Date: Tue, 17 Nov 92 09: 16:05 CST
Organization: Honeywell Systems & Research Center
Date: Tue, 17 Nov 1992 15:16:05 GMT
Received-Date: Tue, 17 Nov 92 09: 16:06 CST

Seems to me this should be easy, but I'm having trouble thinking of a good
way to do it.

I have a string of substrings. The substrings may be enclosed in
double-quotes, or they may be enclosed in curly braces. The substrings may
have embedded variable references, maybe even embedded bracketed commands.

For instance, 
    stuff-stuff "press here" -aardvarks "foo -x $a"
or
    stuff-stuff "press here" -aardvarks {foo -x $a}

I want to preprocess the string "according to the normal Tcl rules" -- the
variable references which are not protected by curly braces should be
replaced by their values; similarly, the bracketed commands which aren't
protected should be evaluated and replaced by their results.  So in the
first example, $a should be replaced by its value, but in the second it
should be left alone.

I can't simply eval the string, because eval wants stuff-stuff to be a
command name.  If I use lindex to tease apart the top-level chunks, I lose
the information about which chunks were wrapped in double quotes and which
ones were wrapped in curly braces.  As a workaround, I can define a proc
stuff-stuff, but that seems unusually perverse.

What am I missing?

					  John Kimball

DOMAIN: jkimball@src.honeywell.com        Honeywell Systems and Research Center
        postmaster@src.honeywell.com      Computer Sciences/Software Technology
UUCP:   <any-smart-host>!srcsip!jkimball  3660 Technology Drive, MN65-2100
VOICE:  +1 612/951-7343   FAX: 7438       Minneapolis, MN  55418-1006
STATUS:  "Will do research for food."
Newsgroups: comp.lang.tcl
From: shmdgljd@rchland.vnet.ibm.com (Jay Schmidgall)
Subject: patch for tkfonts
Date: Mon, 23 Nov 1992 16:52:38 GMT
Reply-To: jay@vnet.ibm.com
Disclaimer: This posting represents the poster's views, not necessarily those of IBM
Organization: IBM Rochester, MN

Apparently, 7x13b must just be a local alias for 7x13bold. Display font
with Double button 1, rather than just Button1, and Button 3 to close
the selected font. Also fixes a problem with font names that have spaces,
e.g., *-new century schoolbook-*.  Ray Davis and Don Libes noted the 7x13b
problem, Ray provided the Button3 to close/Double-1 to display.

I would've posted a context diff, but it'd be as long as the original.

4c4,5
<     global text
---
>     global text font winlist
>     set font [lindex "$args" 0]
5a7
>     set winlist($font) $w
7c9
<     wm title $w $args
---
>     wm title $w "$font"
16c18
<     text $w.t1 -font $args \
---
>     text $w.t1 -font "$font" \
45c47
<     -font 7x13b \
---
>     -font 7x13bold \
49,50c51,60
< bind .frame.list <ButtonRelease-1> \
<     { showfont %t [%W get [%W curselection]] }
---
> bind .frame.list <Double-Button-1> \
> {
>     if { [catch { wm withdraw $winlist([%W get [%W curselection]]) }] } {
> 	showfont %t [ %W get [%W curselection]]
>     } else {
> 	wm deiconify $winlist([%W get [%W curselection]])
>     }
> }
> bind .frame.list <ButtonRelease-3> \
>     { catch { destroy $winlist([%W get [%W curselection]]) } }

-- 
: jay          jay@vnet.ibm.com    My opinions and ideas, not my employer's.
: shmdgljd@rchland.vnet.ibm.com    (c) Copyright 1992.  All rights reserved.
From: bagwill@swe.ncsl.nist.gov (Bob Bagwill)
Newsgroups: comp.lang.tcl
Subject: Re: SOURCE - man.tk - gross little hack
Date: 19 Nov 92 20:20:08 GMT
X-Newsreader: TIN [version 1.1 PL6]

Jordan K Hubbard (jkh@esel.lotus.com) wrote:
: Cute presentation format - pity that 'man -D' works on so few
: systems (tried it on Solaris 1 & 2, AIX, HPUX, 386BSD, zilch..).
: Care to filter the output?
: 
: 				Jordan

Ok, apply this patch:

23c23,24
<       .$page.text insert 1.0 [exec man -D $page]
---
>       regsub -all _\010 [exec man $page] "" clean
>       .$page.text insert 1.0 $clean

--
Bob Bagwill
bagwill@swe.ncsl.nist.gov
Newsgroups: comp.lang.tcl
From: spencer@med.umich.edu (Spencer W. Thomas)
Subject: Re: Scrollable buttons?
Date: Fri, 20 Nov 92 15:58:07 EST
Organization: University of Michigan
	<SPENCER.92Nov19031842@guraldi.med.umich.edu>

In article <SPENCER.92Nov19031842@guraldi.med.umich.edu> spencer@med.umich.edu (Spencer W. Thomas) writes:
> - Use winfo reqheight/reqwidth to figure out how big the window will
>   be.

Sigh.  I got ahead of myself here.  Only some windows get reqheight
and reqwidth right before they're realized (X technical term).  I
tested it with a label, and it worked.  However, a form with a label
and an entry inside it gives back reqheight/width of 0 until the next
update.  I came up with this, which does work in my application.  It's
better than my previous solution, which stacked all the windows at 0,0
and then shuffled them to the appropriate final location.

	<Create windows, make a list of window names>

	update
	# Note that the windows are not visible because they haven't
	# been placed on the canvas yet.  But they do have a real
	# height and width now.

	foreach w $windowlist {
		<Compute appropriate x/y position>
		canvas create window $x $y -window $w ....
	}

--
=Spencer W. Thomas 		|  Info Tech and Networking, B1911 CFOB, 0704
   "Genome Informatician"	|  Univ of Michigan, Ann Arbor, MI 48109
Spencer.W.Thomas@med.umich.edu	|  313-747-2778, FAX 313-764-4133
Newsgroups: comp.lang.tcl
From: scoob@bnr.ca (Christian Marcotte)
Subject: RadioButtons variable problem!!!
Organization: Bell-Northern Research, Ontario, Canada
Date: Thu, 19 Nov 1992 05:49:11 GMT


I have this strange problem with my radiobuttons:

In my application (modified from the mkRadio demo in tk) I do the
following:

     ...
	radiobutton .frame.Months.$month -text $month -variable month \
	    -relief flat -value $month 
     ...

Later I set the default to the current month:
 
	.frame.Months.$currentMonth invoke

And finally I have a button that will call another command with
the values collected from the radio buttons selections.

	button .cmdBar.day_select -text " Day Selection " \
	    -command "day_selection {$base_dir/$year/$typeOfAsset/$month \
	              $typeOfAsset $month $year}"


When I test the value of my buttons by adding a call to showVars.tcl (also 
from the tk demo) I can see that my variables are properly set when I press
the buttons.


However, when I press the " Day Selection " button, it invariably passes
the default values that I had set using "invoke".

I understand that it must have something to do with delaying the evaluation of
the variable but I'm not sure exactly how to correct this.

Any guru advices...

Thanks

-- scoob



-- 
---------------------------------------------------------------------------
Christian Marcotte                Bell-Northern Research
scoob@bnr.ca                      3500 Carling Ave
Telephone: (613) 763-2782         Nepean, Ont., Canada K1Y 4H7
Newsgroups: comp.lang.tcl
From: scoob@bnr.ca (Christian Marcotte)
Subject: Re: RadioButtons variable problem!!!
Organization: Bell-Northern Research, Ontario, Canada
Date: Sat, 21 Nov 1992 04:27:35 GMT


I found the problem with my radio buttons (funny that no one replied on it...)


>     ...
>	radiobutton .frame.Months.$month -text $month -variable month \
>	    -relief flat -value $month 
>     ...
>
>Later I set the default to the current month:
> 
>	.frame.Months.$currentMonth invoke
>
>And finally I have a button that will call another command with
>the values collected from the radio buttons selections.
>
>	button .cmdBar.day_select -text " Day Selection " \
>	    -command "day_selection {$base_dir/$year/$typeOfAsset/$month \
>	              $typeOfAsset $month $year}"

I go it to work by modifying the last two lines:

	    -command {day_selection $base_dir/$year/$typeOfAsset/$month \
  	            ^^^            $typeOfAsset $month $year}
                   ^^^^^                                  ^^^
                                                         ^^^^^

I removed the inner braces and replaced the outer double quotes with braces...

-- Scoob


-- 
---------------------------------------------------------------------------
Christian Marcotte                Bell-Northern Research
scoob@bnr.ca                      3500 Carling Ave
Telephone: (613) 763-2782         Nepean, Ont., Canada K1Y 4H7
From: jacob@fy.chalmers.se (Jacob Hallen)
Newsgroups: comp.lang.tcl
Subject: Possible tk bug and some questions
Date: 16 Nov 92 05:59:50 GMT
Organization: Chalmers University of Technology, G|teborg, Sweden

QUESTIONS

- Is it possible to warp the mouse pointer from inside tk?
- Is it possible to have one binding of an event (<1> for instance) in the
  canvas in general, and a different binding of the same event inside
  an item of the canvas?


POSSIBLE TK BUG

The code below does the following:
- Create a rectangle inside the canvas
- Read a string to put in the middle of the rectangle. This is done by
  creating a window with an Ok button and an entry box.
- Bind events to the rectangle and the text

The problem is this:
If I have the outcommented grabs in place, I need tp press a mouse
button before I get the Any-events in my canvas. Is this as it should be?

************************************************************************
proc scrollNmread { nm } {
  global xName;
  set xName ["$nm.entry" get]
}
proc scrollMkname {{ nm .nameentry }} { 
  global xName;
  set xName "";
  toplevel $nm;
  entry $nm.entry -state normal -width 20 -relief sunken
    button $nm.bt -text Ok\
      -command "scrollNmread $nm";
  bind $nm.entry <Key-Return> "scrollNmread $nm";
  pack append $nm $nm.entry {top expand} $nm.bt {bottom filly}
#  grab $nm;
  set a [focus]
  focus $nm.entry;
  tkwait variable xName;
#  grab none;
  focus $a;
  destroy $nm;
  return $xName 
}

proc scrollMkroom {canvas x y} {
  set bg pink2;
  set x [$canvas canvasx $x];
  set y [$canvas canvasy $y];
  set id [ $canvas create rect [expr $x-40] [expr $y-20]\
	  [expr $x+40] [expr $y+20] -outline black -fill $bg -tags rect ];
  set id2 [$canvas create text $x $y -text [scrollMkname] \
    -anchor center -tags text];
      
  $canvas bind $id <Any-Enter> "scrollEnter $canvas";
  $canvas bind $id <Any-Leave> "scrollLeave $canvas";
  $canvas bind $id <Double-1> "scrollButton $canvas";
  $canvas bind $id <1> "scrollStartDrag $canvas %x %y";
  $canvas bind $id <B1-Motion> "scrollDrag $canvas %x %y";

  $canvas bind $id2 <Any-Enter> "scrollEnter $canvas";
  $canvas bind $id2 <Any-Leave> "scrollLeave $canvas";
  $canvas bind $id2 <Double-1> "scrollButton $canvas";
  $canvas bind $id2 <1> "scrollStartDrag $canvas %x %y";
  $canvas bind $id2 <B1-Motion> "scrollDrag $canvas %x %y";
}
Newsgroups: comp.lang.tcl
From: scot@kaw.eel.ufl.edu (Scott Miller)
Subject:  Saving Canvases
Reply-To: scot@eel.ee.ufl.edu
Organization: UF EE Department
Date: Mon, 23 Nov 92 20:31:18 GMT


Is it possible to save a canvas? I have put
widgets on my canvas and moved them around but
now I want to save those changes.
From: karl@NeoSoft.com (Karl Lehenbauer)
Newsgroups: comp.lang.tcl
Subject: Re: variable visibility problem
Date: 18 Nov 92 07:31:04 GMT
Article-I.D.: NeoSoft.BxwI80.MFB
Organization: NeoSoft Communications Services -- (713) 684-5900

In article <PRZEMEK.92Nov17130700@rrdstrad.nist.gov> przemek@rrdstrad.nist.gov (Przemek Klosowski) writes:
>	  [button $w.plot.Qp -text "E-Q-space plot" -relief raised \
>                        -command "MyPlot $num $w $zoomfac"] {right}
>Of course the code above does not work, because $zoomfac is evaluated
>once at the creation of button, and the MyPlot command is called with
>a constant argument. My second try was
>	  [button $w.plot.Qp -text "E-Q-space plot" -relief raised \
>                        -command {MyPlot $num $w $zoomfac}] {right}
>but this in turn fails, because $num is not a valid variable in the
>routine from which MyPlot is called.

	  [button $w.plot.Qp -text "E-Q-space plot" -relief raised \
                        -command "MyPlot $num $w \$zoomfac"] {right}
						 ^
You can use backslash to quote a dollar sign ----^ and get it evaluated
when the button is pressed rather than when the button is created.

I have seen a tendency on the part of myself and others to write some 
fairly huge -command arguments with a lot of exotic quoting to get 
things to come out just right.  I would rather that we subsume this
complexity into procs to make it easier to read and understand, something
like:

proc plot_button {num w} {
    global zoomfac

    MyPlot $num $w $zoomfac
}

    button $w.plot.Qp -text "E-Q-space plot" -relief raised \
	    -command "plot_button $num $w"

    pack $w.plot.Qp ...

-- 
-- Email info@NeoSoft.com for info on getting interactive Internet access.
"Turn on your hot tub by email now.  Ask me how."
Newsgroups: comp.lang.tcl
From: trones@dxcern.cern.ch (Jostein Lodve Trones)
Subject: Multiple text-lines in buttons 
Reply-To: trones@dxcern.cern.ch (Jostein Lodve Trones)
Organization: CERN, European Laboratory for Particle Physics, Geneva
Date: Fri, 20 Nov 1992 09:44:18 GMT


Is it possible to have two or more lines of text in a button?

I tried with a -text option like: -text "This is line 1 \n and this line 2"
but I still got them on the same line.

Thank's!

Cheers, 
	Jostein
Newsgroups: comp.lang.tcl