Bwidget Source Code
Check-in [89c469e792]
Not logged in
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Added an additional x and y offset for the see command. This allows me to move the visible area to a widget that is inside of a scrolled frame child.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 89c469e7929671e9aee9be3baa44d9abcb2d3f44
User & Date: sven 1999-10-14 20:23:21
Context
1999-10-16
01:06
* dialog.tcl: Added an overrideredirect option to Dialog::draw, which allows the user to control the overrideredirect state of the dialog. check-in: 6c488ce999 user: ericm tags: trunk
1999-10-14
20:23
Added an additional x and y offset for the see command. This allows me to move the visible area to a widget that is inside of a scrolled frame child. check-in: 89c469e792 user: sven tags: trunk
1999-09-21
17:26
ChangeLog commit. check-in: d4865f7d47 user: ericm tags: trunk, scriptics-bc-1-0-b1
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to scrollframe.tcl.

1
2
3
4
5
6
7
8
9
10
11
...
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
...
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
# ------------------------------------------------------------------------------
#  scrollframe.tcl
#  This file is part of Unifix BWidget Toolkit
#  $Id: scrollframe.tcl,v 1.1.1.1 1999/08/03 20:20:23 ericm Exp $
# ------------------------------------------------------------------------------
#  Index of commands:
#     - ScrollableFrame::create
#     - ScrollableFrame::configure
#     - ScrollableFrame::cget
#     - ScrollableFrame::getframe
#     - ScrollableFrame::see
................................................................................
# ------------------------------------------------------------------------------
#  Command ScrollableFrame::getframe
# ------------------------------------------------------------------------------
proc ScrollableFrame::getframe { path } {
    return $path.frame
}


# ------------------------------------------------------------------------------
#  Command ScrollableFrame::see
# ------------------------------------------------------------------------------
proc ScrollableFrame::see { path widget {vert top} {horz left}} {
    set x0  [winfo x $widget]
    set y0  [winfo y $widget]
    set x1  [expr {$x0+[winfo width  $widget]}]
    set y1  [expr {$y0+[winfo height $widget]}]
    set xb0 [$path:cmd canvasx 0]
    set yb0 [$path:cmd canvasy 0]
    set xb1 [$path:cmd canvasx [winfo width  $path]]
    set yb1 [$path:cmd canvasy [winfo height $path]]
    set dx  0
    set dy  0

    if { ![string compare $horz "left"] } {
	if { $x1 > $xb1 } {
	    set dx [expr {$x1-$xb1}]
	}
	if { $x0 < $xb0+$dx } {
	    set dx [expr {$x0-$xb0}]
	}
................................................................................
	    set dy [expr {$y0-$yb0}]
	}
	if { $y1 > $yb1+$dy } {
	    set dy [expr {$y1-$yb1}]
	}
    }

    if { $dx != 0 } {
	set x [expr {($xb0+$dx)/[winfo width $path.frame]}]
	$path:cmd xview moveto $x
    }
    if { $dy != 0 } {
	set y [expr {($yb0+$dy)/[winfo height $path.frame]}]
	$path:cmd yview moveto $y
    }
}


# ------------------------------------------------------------------------------
#  Command ScrollableFrame::xview


|







 







<



|










|







 







|
|


|
|







1
2
3
4
5
6
7
8
9
10
11
...
116
117
118
119
120
121
122

123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
...
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
# ------------------------------------------------------------------------------
#  scrollframe.tcl
#  This file is part of Unifix BWidget Toolkit
#  $Id: scrollframe.tcl,v 1.2 1999/10/14 20:23:21 sven Exp $
# ------------------------------------------------------------------------------
#  Index of commands:
#     - ScrollableFrame::create
#     - ScrollableFrame::configure
#     - ScrollableFrame::cget
#     - ScrollableFrame::getframe
#     - ScrollableFrame::see
................................................................................
# ------------------------------------------------------------------------------
#  Command ScrollableFrame::getframe
# ------------------------------------------------------------------------------
proc ScrollableFrame::getframe { path } {
    return $path.frame
}


# ------------------------------------------------------------------------------
#  Command ScrollableFrame::see
# ------------------------------------------------------------------------------
proc ScrollableFrame::see { path widget {vert top} {horz left} {xOffset 0} {yOffset 0}} {
    set x0  [winfo x $widget]
    set y0  [winfo y $widget]
    set x1  [expr {$x0+[winfo width  $widget]}]
    set y1  [expr {$y0+[winfo height $widget]}]
    set xb0 [$path:cmd canvasx 0]
    set yb0 [$path:cmd canvasy 0]
    set xb1 [$path:cmd canvasx [winfo width  $path]]
    set yb1 [$path:cmd canvasy [winfo height $path]]
    set dx  0
    set dy  0
    
    if { ![string compare $horz "left"] } {
	if { $x1 > $xb1 } {
	    set dx [expr {$x1-$xb1}]
	}
	if { $x0 < $xb0+$dx } {
	    set dx [expr {$x0-$xb0}]
	}
................................................................................
	    set dy [expr {$y0-$yb0}]
	}
	if { $y1 > $yb1+$dy } {
	    set dy [expr {$y1-$yb1}]
	}
    }

    if { [expr {$dx + $xOffset}] != 0 } {
	set x [expr {($xb0+$dx+$xOffset)/[winfo width $path.frame]}]
	$path:cmd xview moveto $x
    }
    if { [expr {$dy + $yOffset}] != 0 } {
	set y [expr {($yb0+$dy+$yOffset)/[winfo height $path.frame]}]
	$path:cmd yview moveto $y
    }
}


# ------------------------------------------------------------------------------
#  Command ScrollableFrame::xview