Bwidget Source Code
Check-in [49151e60c6]
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. * dynhelp.tcl Added part of last patch, for pre 8.5 tcl from BWidget branch [Patch 2835180].
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 49151e60c6abb2266f275f2842eb86e22345aa1e
User & Date: oehhar 2009-09-03 17:23:30
Context
2009-09-05
20:32
BWidget with style support now to come check-in: 5dba1f00ce user: oberdorfer tags: trunk
2009-09-03
17:23
* 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. * dynhelp.tcl Added part of last patch, for pre 8.5 tcl from BWidget branch [Patch 2835180]. check-in: 49151e60c6 user: oehhar tags: trunk
2009-08-12
07:22
* dynhelp.tcl Use balloon help font TkTooltipFont [Patch 2835180] * dynhelp.tcl(DynamicHelp::_show_help)Replaced aqua conditional code check by $Widget::_aqua check-in: c17d1f3e1b user: oehhar tags: trunk
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
	[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
15
16
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.
	* dynhelp.tcl Added part of last patch, for pre 8.5 tcl from BWidget
    branch [Patch 2835180].

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

	* dynhelp.tcl Use balloon help font TkTooltipFont
	[Patch 2835180] for Kevin Walzer
	* dynhelp.tcl(DynamicHelp::_show_help)Replaced aqua conditional code
	check by $Widget::_aqua

Changes to dynhelp.tcl.

1
2
3
4
5
6
7
8
9
10
11
..
15
16
17
18
19
20
21








22
23
24
25
26
27
28

29
30
31
32
33
34
35
36
37

38
39
40
41
42
43
44
# ----------------------------------------------------------------------------
#  dynhelp.tcl
#  This file is part of Unifix BWidget Toolkit
#  $Id: dynhelp.tcl,v 1.21 2009/08/12 07:22:35 oehhar Exp $
# ----------------------------------------------------------------------------
#  Index of commands:
#     - DynamicHelp::configure
#     - DynamicHelp::include
#     - DynamicHelp::sethelp
#     - DynamicHelp::register
#     - DynamicHelp::_motion_balloon
................................................................................
#     - DynamicHelp::_show_help
#     - DynamicHelp::_init
# ----------------------------------------------------------------------------

namespace eval DynamicHelp {
    Widget::define DynamicHelp dynhelp -classonly









    Widget::declare DynamicHelp {
        {-foreground     TkResource black         0 label}
        {-topbackground  TkResource black         0 {label -foreground}}
        {-background     TkResource "#FFFFC0"     0 label}
        {-borderwidth    TkResource 1             0 label}
        {-justify        TkResource left          0 label}
        {-font           TkResource TkTooltipFont 0 label}

        {-delay          Int        600           0 "%d >= 100 & %d <= 2000"}
	{-state          Enum       "normal"      0 {normal disabled}}
        {-padx           TkResource 1             0 label}
        {-pady           TkResource 1             0 label}
        {-bd             Synonym    -borderwidth}
        {-bg             Synonym    -background}
        {-fg             Synonym    -foreground}
        {-topbg          Synonym    -topbackground}
    }


    proc use {} {}

    variable _registered
    variable _canvases
    variable _texts



|







 







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







1
2
3
4
5
6
7
8
9
10
11
..
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35

36
37
38
39
40
41
42
43
44

45
46
47
48
49
50
51
52
# ----------------------------------------------------------------------------
#  dynhelp.tcl
#  This file is part of Unifix BWidget Toolkit
#  $Id: dynhelp.tcl,v 1.22 2009/09/03 17:23:30 oehhar Exp $
# ----------------------------------------------------------------------------
#  Index of commands:
#     - DynamicHelp::configure
#     - DynamicHelp::include
#     - DynamicHelp::sethelp
#     - DynamicHelp::register
#     - DynamicHelp::_motion_balloon
................................................................................
#     - DynamicHelp::_show_help
#     - DynamicHelp::_init
# ----------------------------------------------------------------------------

namespace eval DynamicHelp {
    Widget::define DynamicHelp dynhelp -classonly

    if {$::tcl_version >= 8.5} {
        set fontdefault TkTooltipFont
    } elseif {$Widget::_aqua} {
        set fontdefault {helvetica 11}
    } else {
        set fontdefault {helvetica 8}
    }

    Widget::declare DynamicHelp [list\
        {-foreground     TkResource black         0 label}\
        {-topbackground  TkResource black         0 {label -foreground}}\
        {-background     TkResource "#FFFFC0"     0 label}\
        {-borderwidth    TkResource 1             0 label}\
        {-justify        TkResource left          0 label}\

        [list -font      TkResource $fontdefault  0 label]\
        {-delay          Int        600           0 "%d >= 100 & %d <= 2000"}\
	{-state          Enum       "normal"      0 {normal disabled}}\
        {-padx           TkResource 1             0 label}\
        {-pady           TkResource 1             0 label}\
        {-bd             Synonym    -borderwidth}\
        {-bg             Synonym    -background}\
        {-fg             Synonym    -foreground}\
        {-topbg          Synonym    -topbackground}\

    ]

    proc use {} {}

    variable _registered
    variable _canvases
    variable _texts

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.16 2009/09/03 17:23:30 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}]}