> > >   I'm trying to create a scrollable canvas widget within Visual TCL.
> > > I've associated the scrollbars with the canvas, set the geometry, and
> > > set size attributes.  The scroll bars move properly, but none
> > > of the widgets I've placed in the canvas move.  What am I doing wrong
> > > or missing?
> > > 
> > > VTCL 1.2.0
> > > TCL/TK 8.2
> > > OS: Win95 (the os choice is dictated to me, it is not by my choice)
> > > 
> > 
> > Note: VTCL 1.20 has a builtin scrollable canvas:
> > 
> >    Compound > Insert > System > ...
> > 
> > || Ken Bowen      Applied Logic Systems, Inc.         PO Box 400175,     
> > ||====            Voice:  +1 (617)497-0100            Cambridge
> > ||                FAX:    +1 (617)497-3963            MA  02140  USA
> >                   Email:  [EMAIL PROTECTED]        WWW: http://www.als.com
> >
> 
> Tried that, as per your advise.  I still end up with a widget that the
> scrollbars do nothing.  Again I tried adjusting the same settings as above.
> Any more suggestions?
> 
You may not be placing things on the canvas correctly.
To see how it all goes, try the following outline:
 
In vtcl:

File > New
   Name it "dddd"
Compound > Insert > System > Scrollable Canvas
   Places the scrolled canvas on your toplevel.
Save 
   Name the file "foo.tcl"
------
Use your favorite editor to open foo.tcl
Place the following lines at the very end of the file:

.dddd.cpd17.03 create text 50 50 -text "This is some text"
.dddd.cpd17.03 create oval 5 5 50 50 -fill blue

Exit and source the file in wish.  The blue oval and text scroll.

=========================================
Here's the complete file:


#############################################################################
# Visual Tcl v1.20 Project
#

#################################
# GLOBAL VARIABLES
#
global widget; 

#################################
# USER DEFINED PROCEDURES
#
proc init {argc argv} {

}

init $argc $argv


proc {main} {argc argv} {

}

proc {Window} {args} {
global vTcl
    set cmd [lindex $args 0]
    set name [lindex $args 1]
    set newname [lindex $args 2]
    set rest [lrange $args 3 end]
    if {$name == "" || $cmd == ""} {return}
    if {$newname == ""} {
        set newname $name
    }
    set exists [winfo exists $newname]
    switch $cmd {
        show {
            if {$exists == "1" && $name != "."} {wm deiconify $name; return}
            if {[info procs vTclWindow(pre)$name] != ""} {
                eval "vTclWindow(pre)$name $newname $rest"
            }
            if {[info procs vTclWindow$name] != ""} {
                eval "vTclWindow$name $newname $rest"
            }
            if {[info procs vTclWindow(post)$name] != ""} {
                eval "vTclWindow(post)$name $newname $rest"
            }
        }
        hide    { if $exists {wm withdraw $newname; return} }
        iconify { if $exists {wm iconify $newname; return} }
        destroy { if $exists {destroy $newname; return} }
    }
}

#################################
# VTCL GENERATED GUI PROCEDURES
#

proc vTclWindow. {base} {
    if {$base == ""} {
        set base .
    }
    ###################
    # CREATING WIDGETS
    ###################
    wm focusmodel $base passive
    wm geometry $base 200x200+0+0
    wm maxsize $base 1028 753
    wm minsize $base 104 1
    wm overrideredirect $base 0
    wm resizable $base 1 1
    wm withdraw $base
    wm title $base "vt"
    ###################
    # SETTING GEOMETRY
    ###################
}

proc vTclWindow.dddd {base} {
    if {$base == ""} {
        set base .dddd
    }
    if {[winfo exists $base]} {
        wm deiconify $base; return
    }
    ###################
    # CREATING WIDGETS
    ###################
    toplevel $base -class Toplevel
    wm focusmodel $base passive
    wm geometry $base 228x197+175+366
    wm maxsize $base 1028 753
    wm minsize $base 104 1
    wm overrideredirect $base 0
    wm resizable $base 1 1
    wm deiconify $base
    wm title $base "New Toplevel 1"
    frame $base.cpd17 \
        -borderwidth 1 -height 50 -relief raised -width 45 
    scrollbar $base.cpd17.01 \
        -borderwidth 1 -command {.dddd.cpd17.03 xview} -orient horiz \
        -width 10 
    scrollbar $base.cpd17.02 \
        -borderwidth 1 -command {.dddd.cpd17.03 yview} -orient vert -width 10 
    canvas $base.cpd17.03 \
        -borderwidth 2 -height 165 -relief ridge -width 180 \
        -xscrollcommand {.dddd.cpd17.01 set} \
        -yscrollcommand {.dddd.cpd17.02 set} 
    ###################
    # SETTING GEOMETRY
    ###################
    grid $base.cpd17 \
        -in .dddd -column 0 -row 0 -columnspan 1 -rowspan 1 
    grid columnconf $base.cpd17 0 -weight 1
    grid rowconf $base.cpd17 0 -weight 1
    grid $base.cpd17.01 \
        -in .dddd.cpd17 -column 0 -row 1 -columnspan 1 -rowspan 1 -sticky ew 
    grid $base.cpd17.02 \
        -in .dddd.cpd17 -column 1 -row 0 -columnspan 1 -rowspan 1 -sticky ns 
    grid $base.cpd17.03 \
        -in .dddd.cpd17 -column 0 -row 0 -columnspan 1 -rowspan 1 \
        -sticky nesw 

}

Window show .
Window show .dddd

main $argc $argv

.dddd.cpd17.03 create text 50 50 -text "This is some text"
.dddd.cpd17.03 create oval 5 5 50 50 -fill blue

|| Ken Bowen      Applied Logic Systems, Inc.         PO Box 400175,     
||====            Voice:  +1 (617)497-0100            Cambridge
||                FAX:    +1 (617)497-3963            MA  02140  USA
                  Email:  [EMAIL PROTECTED]        WWW: http://www.als.com

---------------------------------------------------------------------------
To unsubscribe from the Visual Tcl mailing list, please send a message
to [EMAIL PROTECTED] with "unsubscribe vtcl [EMAIL PROTECTED]" in the
message body (where [EMAIL PROTECTED] is your e-mail address).

Reply via email to