delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/04/27/19:42:16

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Message-ID: <10ec01c0cf6d$bf70cec0$48a80241@glstnbry1.ct.home.com>
From: "MarK Stucky" <mstucky5 AT home DOT com>
To: "Karr, David" <david DOT karr AT cacheflow DOT com>, <cygwin AT cygwin DOT com>
References: <2C08D4EECBDED41184BB00D0B747334202FB4335 AT exchanger DOT cacheflow DOT com>
Subject: Re: Information on running tcl/tk with cygwin?
Date: Fri, 27 Apr 2001 18:59:42 -0400
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 5.00.2615.200
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200

----- Original Message -----
From: Karr, David <david DOT karr AT cacheflow DOT com>
To: <cygwin AT cygwin DOT com>
Sent: Friday, April 27, 2001 3:38 PM
Subject: RE: Information on running tcl/tk with cygwin?


  > No, not tkdiff.  It's an interface to "diff3" that I'm looking for.
  > Nevertheless, I believe I found the script I needed, but now I'm a
little
  > concerned about the hacks I had to do to get it to work at all (and I
  > haven't fully tested it yet).  I discovered that I have to be very
  > particular about how I provide paths to the tcl script.  Obviously, I
have
  > to change "wish" to "cygtclwish80".  I might create a symlink, so I
don't
  > always have to hack third-party scripts.  I also discovered, as you
clearly
  > did, that you even have to be careful how you invoke the script.  For
  > instance, if you execute it through the Cygwin PATH, and you have it in
  > "/home/myname/bin", then it will fail to find it.  You have to execute
it
  > with the Windows path.
  >
  > The other annoyance is that "puts" seems to have no effect, whether I
write
  > to stdout or stderr.  Nothing comes out.


Windows applications don't normally have a console attached to
them.

The cygnus version of "wish" is no exception.  It is a normal
Windows application.  The Windows version of wish does have
a hidden/fake console (that is created by wish) that can be
displayed if you add a

    console show

to your application.  Note, the above command is only valid
when you run your script under Windows, so you will want to
check in the code to make sure that you are running under
Windows and not under Unix (ie check the value of the
"tcl_platform(platform)" variable).  See the code below...


  > -----Original Message-----
  > From: Troy Noble [mailto:troy DOT noble AT channelpoint DOT com]
  > Sent: Friday, April 27, 2001 12:27 PM
  > To: 'Karr, David'; 'cygwin AT cygwin DOT com'
  > Subject: RE: Information on running tcl/tk with cygwin?

     ...

  > I recall having to do something to get it to work with cygwin
  > since line 4 of the script reads:
  >
  > exec wish "$0" -- ${1+"$@"}
  >
  > and of course wish is really called cygwish80.exe in the cygwin
  > distro.  Could probably solve it with a symlink or an alias
  > of wish that refers to cygwish80.exe, I will leave that up to
  > you to try.
  >
  > If I recall, I just commented out that line and then I start
  > the script using an alias that I define in my .bashrc:
  >
  > alias tkdiff="cygwish80.exe -f /cygwin/usr/local/bin/tkdiff.tcl"
  >
  > Troy

What I ended up doing was to create a symlink "wish" that
refers to cygwish80.exe as Troy mentioned.

And then I replaced the "$0" argument with `cygpath -w $0`
so that it uses the Windows style path.  Again, see the
code below for an example...

Also note that cygwish80 is not a cygwin application
and doesn't understand a cygwin style path.  If you need
to refer to a file within your application, use a Windows
path.

If you have any questions, let me know...

--Mark



#!/bin/sh
#-*-tcl-*-
# the next line restarts using wish \
exec wish `cygpath -w $0` ${1+"$@"}

if {$tcl_platform(platform) == "windows"} {
    console show
}

puts "This is text should appear in the console window..."

after 5000 {set flag 0}
vwait flag

puts " "
puts "Now let's create a text window..."
puts " "
puts "and send output to it."

after 3000 {set flag 0}
vwait flag

    button .quit -text "Exit" -command exit
    pack .quit -side bottom

    frame .puts
    text .puts.text -xscrollcommand ".puts.h_scrollbar set" \
                    -yscrollcommand ".puts.v_scrollbar set" \
                    -relief sunken -wrap none \
                    -height 20

    scrollbar .puts.v_scrollbar -command ".puts.text yview" -orient vertical
    scrollbar .puts.h_scrollbar -command ".puts.text xview" -orient
horizontal

    pack .puts.v_scrollbar -side right  -fill y
    pack .puts.h_scrollbar -side bottom -fill x
    pack .puts.text        -side left -fill both -expand yes

    pack .puts             -side bottom -fill both -expand yes \
                           -anchor s

########################################################################
########################################################################

proc myPuts {args} {

    if {[lindex $args 0] == "-nonewline"} {
        set newline ""
        set args [lrange $args 1 end]
    } else {
        set newline "\n"
    }
    if {[llength $args] == 2} {
        set text "[lindex $args 1]$newline"
    } else {
        set text "[lindex $args 0]$newline"
    }

    if {[winfo exist .puts.text]} {
        .puts.text insert end $text
        .puts.text yview moveto 1.0
    } else {
        puts $text
    }
    update idletasks
}

########################################################################
########################################################################

raise .

myPuts " "
myPuts "And now, a \"myPuts\" will output text to this area... "
myPuts " "



--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019