Ralph

I am interested in the example you provided. Specifically, the ability to
interface to odbc. Where can I find the code to do this.

Thanks for your time.

Bob

-----Original Message-----
From: Ralph McCord [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 09, 2001 10:04 AM
To: [EMAIL PROTECTED]
Subject: [vtcl-user] Re: vtcl-user digest, Vol 1 #130 - 2 msgs


Adam,
Don't feel bad, every one of us had to travel down the
same road.
Here some example "proc's" which might help.
They might not be up to production standards but they
work.

#!/bin/sh
# the next line restarts using wish\
exec wish84 "$0" "$@" 

#
# tclodbc utility demo
#
proc {main} {argc argv} {
global cdir dir data
#
# Connect to the DB
#
database db RalphProd sa

#
# Get a Table Def
#
set def [tclodbc::TableDef db notepad]

#
# Make a Truck you can ride on out of it.
#
set deflist [tclodbc::TableDefToSql db $def]

# 
# Save it in a file.
#
set data $deflist
set fn "deflist.txt"
save2file $fn

#
# Have bash run ISQL 
#
proc {Execute_Command} {} {
global widget
# Get the isql command line
set cmd [.top21.fra22.cpd35.02 get] 
# Bash it
set rpt [exec bash -c "$cmd"] 
# Clear the main text widget
.top21.fra22.cpd39.03 delete 1.0 end 
# Display the results
.top21.fra22.cpd39.03 insert 1.0 "$rpt"

#OR

# Let the shell do it.
set cmd "My_Shell_Script $arg1 $arg2 $and_so_on"
set rpt [readpipe $cmd]
.top21.fra22.cpd39.03 delete 1.0 end 
.top21.fra22.cpd39.03 insert 1.0 "$rpt"
return;
} 

proc init {argc argv} {
global cdir dir data
set data ""
set cdir [pwd]
set dir "C:/Program Files/Tcl/lib/tclodbc2.2"
package require tclodbc
cd $cdir
} 

proc {save2file} {arg} {
global data
set fn $arg
#set data [.top21.fra22.cpd24.03 get 1.0 end]
set fileid [open $fn "w"]
puts $fileid $data
close $fileid
} 

proc {readpipe} {cmd} {
global widget
#-------------------------------------------------
# read_pipe will execute the command that was passed,
and then
# return the piped output back to you.
#-------------------------------------------------
    # initialize
    global errorCode errorInfo
    set data   ""
    set errvar ""     # Start piped command.
    #set logit "splogit $cmd"
    #set junk [ open "|$logit" r ]
    set fileid [ open "|$cmd" r ]
    if { $fileid != "" }  {
        # read data
        set data [read $fileid]
        set err [ catch { close $fileid } $errvar ]
        #if { $err > 1 } { tkerror $errvar }
    }
    return $data
}

# Initialize the environment.
init $argc $argv

# Run it.
main $argc $argv

# Bye!
exit;



--- [EMAIL PROTECTED] wrote:
> Send vtcl-user mailing list submissions to
>       [EMAIL PROTECTED]
> 
> To subscribe or unsubscribe via the World Wide Web,
> visit
> 
>
http://lists.sourceforge.net/lists/listinfo/vtcl-user
> or, via email, send a message with subject or body
> 'help' to
>       [EMAIL PROTECTED]
> 
> You can reach the person managing the list at
>       [EMAIL PROTECTED]
> 
> When replying, please edit your Subject line so it
> is more specific
> than "Re: Contents of vtcl-user digest..."
> 
> 
> Today's Topics:
> 
>    1. Visual Tcl specific reference manual/tutorial
> docs (Adam Short)
>    2. Re: Visual Tcl specific reference
> manual/tutorial docs ([EMAIL PROTECTED])
> 
> --__--__--
> 
> Message: 1
> Date: Thu, 08 Mar 2001 13:16:50 -0000
> To: [EMAIL PROTECTED]
> From: Adam Short <[EMAIL PROTECTED]>
> Subject: [vtcl-user] Visual Tcl specific reference
> manual/tutorial docs
> Reply-To: [EMAIL PROTECTED]
> 
> Hi,
> 
> I'm new to Tcl/Tk and everything that goes with it.
> I downloaded Visual Tcl because it looked like a
> good starting point for someone who is used to
> Visual Basic to 
> start programming in Linux. I've had a play around
> with it and for the most part I like it a lot. There
> is just one thing thats holding me back. I could use
> a few examples 
> of how to program with Visual Tcl specifically. I've
> seen Tcl and Tk references but they are for writing
> from scratch in a text editor and at this stage I
> don't know what 
> is done by Visual Tcl when I'm editing and what I
> still need to do by hand. 
> 
> What would be really nice would be some kind of
> example of how to integrate the Tcl code with the
> widgets. I tried to write a little text editor app
> last night and I came 
> horribly unstuck trying to sort out how to save and
> load the files. I tried to do it with Tcl and failed
> miserably, then I saw that there was a command
> associated with the 
> Scrolledtext widget for doing this and it worked.
> Which is the correct way to do it? How do I
> correctly reference attributes of the widgets? I'm
> used to the 
> "widget.attribute" convention but I can see that
> doesn't work here.
> 
> If anyone can tell me anywhere I can get some useful
> examples written with Visual Tcl could you please
> let me know. I learn mostly by example and usually
> quite 
> quickly. In this case I just need a nudge in the
> right direction.
> 
> Thanks
> 
> Adam
> 
> 
> 
> 
> --__--__--
> 
> Message: 2
> Subject: Re: [vtcl-user] Visual Tcl specific
> reference manual/tutorial docs
> To: [EMAIL PROTECTED]
> From: [EMAIL PROTECTED]
> Date: Thu, 8 Mar 2001 09:13:14 -0800
> Reply-To: [EMAIL PROTECTED]
> 
> 
> Yes, that's a problem. Damon and I spent many hours
> to improve the
> software,
> (let's not forget to thank all of you who sent
> patches and bug reports)
> but at the same time we still don't have any
> documentation available
> (almost none).
> 
> The tutorial is really old and there is just 2 or 3
> samples.
> 
> Is anyone interested in creating a comprehensive set
> of samples
> illustrating
> what can be done with Visual Tcl ? Any help
> appreciated!
> 
> Is anyone interested in writing documentation for
> Visual Tcl 1.5 ?
> Documentation could also consist of more "Tips of
> the day" (we just have
> a few).
> 
> CG
> 
> 
> 
> |--------+------------------------------------->
> |        |          Adam Short                 |
> |        |          <[EMAIL PROTECTED]>    |
> |        |          Sent by:                   |
> |        |          [EMAIL PROTECTED]|
> |        |          eforge.net                 |
> |        |                                     |
> |        |                                     |
> |        |          03/08/2001 05:16 AM        |
> |        |          Please respond to vtcl-user|
> |        |                                     |
> |--------+------------------------------------->
>  
>
>---------------------------------------------------------------------------
--------------------------------|
>   |                                                 
>                                                     
>     |
>   |       To:     [EMAIL PROTECTED]   
>                                                     
>     |
>   |       cc:                                       
>                                                     
>     |
>   |       Fax to:                                   
>                                                     
>     |
>   |       Subject:     [vtcl-user] Visual Tcl
> specific reference manual/tutorial docs             
>            |
>   |                                                 
>                                                     
>     |
>  
>
>---------------------------------------------------------------------------
--------------------------------|
> 
> 
> 
> 
> Hi,
> 
> I'm new to Tcl/Tk and everything that goes with it.
> I downloaded Visual Tcl
> because it looked like a good starting point for
> someone who is used to
> Visual Basic to
> start programming in Linux. I've had a play around
> with it and for the most
> part I like it a lot. There is just one thing thats
> holding me back. I
> could use a few examples
> of how to program with Visual Tcl specifically. I've
> seen Tcl and Tk
> references but they are for writing from scratch in
> a text editor and at
> this stage I don't know what
> is done by Visual Tcl when I'm editing and what I
> still need to do by hand.
> 
> What would be really nice would be some kind of
> example of how to integrate
> the Tcl code with the widgets. I tried to write a
> little text editor app
> last night and I came
> horribly unstuck trying to sort out how to save and
> load the files. I tried
> to do it with Tcl and failed miserably, then I saw
> that there was a command
> associated with the
> Scrolledtext widget for doing this and it worked.
> Which is the correct way
> to do it? How do I correctly reference attributes of
> the widgets? I'm used
> to the
> "widget.attribute" convention but I can see that
> doesn't work here.
> 
> If anyone can tell me anywhere I can get some useful
> examples written with
> Visual Tcl could you please let me know. I learn
> mostly by example and
> 
=== message truncated ===


__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/

_______________________________________________
vtcl-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/vtcl-user

_______________________________________________
vtcl-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/vtcl-user

Reply via email to