Robert Heller wrote:
> At Mon, 20 May 2013 19:46:52 +1000 Rob
> <dislexi...@nospamyahoo.com.invalid> wrote:
>
>>
>>
>> In checking how an application I wrote originally for Linux works under
>> Windows XP, I found a significant difference in default positioning of a
>> transient window over a top-level one.
>>
>> Under Linux, the centre of the transient window is automatically
>> positioned over the centre of the top-level window, while under XP the
>> transient aligns with its top-left corner at 0,0 screen position
>> regardless of where the top- level window is positioned.
>
> Are you doing *anything* with the geometry of the transient window?
>
Robert,
The only geometry-related things I do to the transient window are:
a) Related to resizing the label which holds a varying amount of textual
data.
b) Stopping the user manually resizing this window.
Just in case there's something else I'm not aware of, I'll post the relevant
code.
It's quite a bit of code (2 procs). In case it matters, the code for
invoking the transient window is done in the 'displayMediaInfo' proc. The
calling of this proc is set up in the top-level GUI definition as code in a
bind statement.
Rob.
-----------------------------------------------------------------------------
1) Code used to build the transient window:
proc defineInfoDlg {} {
global infoDlg
global mediaTable
toplevel .infoDlg
wm transient .infoDlg .
wm resizable .infoDlg 0 0
set infoDlg(id) ".infoDlg.f1.lbl1"
set infoDlg(comment) ".infoDlg.f1.lbl2"
set infoDlg(button) ".infoDlg.f2.btn"
set infoDlg(toplevel) ".infoDlg"
ttk::frame .infoDlg.f1 -padding 3
ttk::frame .infoDlg.f2 -padding 2
ttk::label $infoDlg(id) -padding 3 -anchor center \
-foreground "blue4"
# wraplength - determined by experiment
ttk::label $infoDlg(comment) \
-wraplength 350 -padding 8 \
-relief sunken \
-justify left -background "lightyellow2"
ttk::button $infoDlg(button) -padding 5 -text "OK" \
-default active -underline 0 \
-command {destroy $infoDlg(toplevel)}
pack .infoDlg.f1 -side top -fill both -expand true
pack .infoDlg.f2 -side top -fill x
pack $infoDlg(id) -side top -fill x
pack $infoDlg(comment) -side top -fill both -expand true
pack $infoDlg(button) -side top
bind $infoDlg(toplevel) <Key-Escape> {
$infoDlg(button) invoke
}
return
}
2) Invoking the transient window as child to top-level window:
proc displayMediaInfo {rownum} {
global mediaTable
global tblColNo
global infoDlg
set infoHeader [file tail [$mediaTable cellcget \
$rownum,$tblColNo(mediafile) -text]]
set comment [$mediaTable cellcget \
$rownum,$tblColNo(comment) -text]
if {$comment == ""} {
set comment "There is no additional\
information for this item\n"
}
defineInfoDlg
$infoDlg(id) configure -text "ID: $infoHeader"
set currWrapLen [$infoDlg(comment) cget -wraplength]
if {[string length $infoHeader] > 35} {
# Use of 'update' statement is required to allow the dynamic
# resizing of 'comment' label and thus the full infoDlg window
update
set currWrapLen [winfo width $infoDlg(comment)]
}
# Reasonable comment size vs. label wrap length - determined by
experiment
if {[string length $comment] > 800} {
set currWrapLen 550
}
$infoDlg(comment) configure -text $comment -wraplength $currWrapLen
wm title $infoDlg(toplevel) "Additional Information"
focus $infoDlg(button)
grab $infoDlg(toplevel)
tkwait window $infoDlg(toplevel)
grab release $infoDlg(toplevel)
selectTableRow $rownum
$mediaTable see $rownum
$mediaTable seecolumn 0
return
}
-----------------------------------------------------------------------------