Bwidget Source Code
Check-in [150292310b]
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:* util.tcl(BWidget::place), BWidget.html Widget placed incorrectly, when bigger than current screen [Bug 2850031] by Thomas Grausgruber Possible incompatibility: BWidget::place w h -> w,h are reduced to screen width
Timelines: family | ancestors | descendants | both | bwidget
Files: files | file ages | folders
SHA1: 150292310bf4577f3894a9d2377fba13d055589c
User & Date: oehhar 2009-09-03 17:29:03
Context
2010-05-12
07:59
t * listbox.tcl(ListBox::_configureSelectmode) Drag modifies multiple selection [Bug 2995969] reported by Robert Karen. Bound events on ButtonRelease-1 instead Button-1 for multiple selections to avoid bug. * listbox.tcl(ListBox::_drag_and_drop) The default drag and drop routine only handled single drag and drop. It was extended to handle also drag and drop of multiple entries. check-in: 229ceefb36 user: oehhar tags: bwidget
2009-09-03
17:29
* util.tcl(BWidget::place), BWidget.html Widget placed incorrectly, when bigger than current screen [Bug 2850031] by Thomas Grausgruber Possible incompatibility: BWidget::place w h -> w,h are reduced to screen width check-in: 150292310b user: oehhar tags: bwidget
2009-08-12
07:20
* dynhelp.tcl Use balloon help font TkTooltipFont if tk <= 8.5. Otherwise use helvetica 11 on Aqua [Patch 2835180] for Kevin Walzer * dynhelp.tcl(DynamicHelp::_show_help)Replaced aqua conditional code check by $Widget::_aqua check-in: 059f4b0efa user: oehhar tags: bwidget
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to BWman/BWidget.html.

170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
</DD></DL>
<DL><DT><A NAME="place">BWidget::<B>place</B></A>
 <I>path</I>
 <I>w</I>
 <I>h</I>
 ?<I>arg...</I>?
</DT><DD>
Used to position and resise the widget specified by
<I>path</I>. <I>w</I> and <I>h</I> are used to specify the requested
width and height of the <I>path</I> widget for use by <B>wm
geometry</B>. The placement of the widget relative to other widgets or
the screen is controlled by additional arguments:
<DL>
 <DT><B>at</B> <I>x</I> <I>y</I></DT>
 <DD>Place the widget specified by the <I>path</I> argument at screen
 position x,y. See <B>wm geometry</B> for information about window
 placement values.</DD>







|


|







170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
</DD></DL>
<DL><DT><A NAME="place">BWidget::<B>place</B></A>
 <I>path</I>
 <I>w</I>
 <I>h</I>
 ?<I>arg...</I>?
</DT><DD>
Used to position and resize the widget specified by
<I>path</I>. <I>w</I> and <I>h</I> are used to specify the requested
width and height of the <I>path</I> widget for use by <B>wm
geometry</B> (set to 0 to use current values). The placement of the widget relative to other widgets or
the screen is controlled by additional arguments:
<DL>
 <DT><B>at</B> <I>x</I> <I>y</I></DT>
 <DD>Place the widget specified by the <I>path</I> argument at screen
 position x,y. See <B>wm geometry</B> for information about window
 placement values.</DD>

Changes to ChangeLog.








1
2
3
4
5
6
7






2009-08-12 Harald Oehlmann  <[email protected]>

	* dynhelp.tcl Use balloon help font TkTooltipFont if tk <= 8.5.
	Otherwise use helvetica 11 on Aqua [Patch 2835180] for Kevin Walzer
	* dynhelp.tcl(DynamicHelp::_show_help)Replaced aqua conditional code
	check by $Widget::_aqua

>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
2009-09-03 Harald Oehlmann  <[email protected]>

	* util.tcl(BWidget::place), BWidget.html Widget placed incorrectly,
	when bigger than current screen [Bug 2850031] by Thomas Grausgruber
	Possible incompatibility: BWidget::place w h -> w,h are reduced to
	screen width.

2009-08-12 Harald Oehlmann  <[email protected]>

	* dynhelp.tcl Use balloon help font TkTooltipFont if tk <= 8.5.
	Otherwise use helvetica 11 on Aqua [Patch 2835180] for Kevin Walzer
	* dynhelp.tcl(DynamicHelp::_show_help)Replaced aqua conditional code
	check by $Widget::_aqua

Changes to utils.tcl.

1
2
3
4
5
6
7
8
9
10
11
...
242
243
244
245
246
247
248
249

250






251









252





253
254
255
256
257
258
259
...
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
# ----------------------------------------------------------------------------
#  utils.tcl
#  This file is part of Unifix BWidget Toolkit
#  $Id: utils.tcl,v 1.15 2009/06/10 08:48:06 oehhar Exp $
# ----------------------------------------------------------------------------
#  Index of commands:
#     - GlobalVar::exists
#     - GlobalVar::setvarvar
#     - GlobalVar::getvarvar
#     - BWidget::assert
#     - BWidget::clonename
................................................................................
#  Currently there is no way to ask Tk the extent of the Windows desktop in 
#  a multi monitor system. Nor what the legal co-ordinate range might be.
#
proc BWidget::place { path w h args } {
    variable _top

    update idletasks
    set reqw [winfo reqwidth  $path]

    set reqh [winfo reqheight $path]






    if { $w == 0 } {set w $reqw}









    if { $h == 0 } {set h $reqh}






    set arglen [llength $args]
    if { $arglen > 3 } {
        return -code error "BWidget::place: bad number of argument"
    }

    if { $arglen > 0 } {
................................................................................
            if { $idx == 1 } {
                if { $arglen == 2 } {
                    # center to widget
                    set x0 [expr {[winfo rootx $widget] + ([winfo width  $widget] - $w)/2}]
                    set y0 [expr {[winfo rooty $widget] + ([winfo height $widget] - $h)/2}]
                } else {
                    # center to screen
                    set x0 [expr {([winfo screenwidth  $path] - $w)/2 - [winfo vrootx $path]}]
                    set y0 [expr {([winfo screenheight $path] - $h)/2 - [winfo vrooty $path]}]
                }
                set x "+$x0"
                set y "+$y0"
                if {$::tcl_platform(platform) != "windows"} {
                    if { $x0+$w > $sw } {set x "-0"; set x0 [expr {$sw-$w}]}
                    if { $x0 < 0 }      {set x "+0"}
                    if { $y0+$h > $sh } {set y "-0"; set y0 [expr {$sh-$h}]}


|







 







<
>
|
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
|
>
>
>
>
>







 







|
|







1
2
3
4
5
6
7
8
9
10
11
...
242
243
244
245
246
247
248

249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
...
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
# ----------------------------------------------------------------------------
#  utils.tcl
#  This file is part of Unifix BWidget Toolkit
#  $Id: utils.tcl,v 1.15.2.1 2009/09/03 17:29:03 oehhar Exp $
# ----------------------------------------------------------------------------
#  Index of commands:
#     - GlobalVar::exists
#     - GlobalVar::setvarvar
#     - GlobalVar::getvarvar
#     - BWidget::assert
#     - BWidget::clonename
................................................................................
#  Currently there is no way to ask Tk the extent of the Windows desktop in 
#  a multi monitor system. Nor what the legal co-ordinate range might be.
#
proc BWidget::place { path w h args } {
    variable _top

    update idletasks


    # If the window is not mapped, it may have any current size.
    # Then use required size, but bound it to the screen width.
    # This is mostly inexact, because any toolbars will still be removed
    # which may reduce size.
    if { $w == 0 && [winfo ismapped $path] } {
        set w [winfo width $path]
    } else {
        if { $w == 0 } {
            set w [winfo reqwidth $path]
        }
        set vsw [winfo vrootwidth  $path]
        if { $w > $vsw } { set w $vsw }
    }

    if { $h == 0 && [winfo ismapped $path] } {
        set h [winfo height $path]
    } else {
        if { $h == 0 } {
            set h [winfo reqheight $path]
        }
        set vsh [winfo vrootheight $path]
        if { $h > $vsh } { set h $vsh }
    }

    set arglen [llength $args]
    if { $arglen > 3 } {
        return -code error "BWidget::place: bad number of argument"
    }

    if { $arglen > 0 } {
................................................................................
            if { $idx == 1 } {
                if { $arglen == 2 } {
                    # center to widget
                    set x0 [expr {[winfo rootx $widget] + ([winfo width  $widget] - $w)/2}]
                    set y0 [expr {[winfo rooty $widget] + ([winfo height $widget] - $h)/2}]
                } else {
                    # center to screen
                    set x0 [expr {($sw - $w)/2 - [winfo vrootx $path]}]
                    set y0 [expr {($sh - $h)/2 - [winfo vrooty $path]}]
                }
                set x "+$x0"
                set y "+$y0"
                if {$::tcl_platform(platform) != "windows"} {
                    if { $x0+$w > $sw } {set x "-0"; set x0 [expr {$sw-$w}]}
                    if { $x0 < 0 }      {set x "+0"}
                    if { $y0+$h > $sh } {set y "-0"; set y0 [expr {$sh-$h}]}