| Ticket UUID: | 721dad1c1bd8bbc8dd03145d0bd0204051d5c1e6 | |||
| Title: | tklib getstring package bug on multi-monitor windows system | |||
| Type: | Bug | Version: | 8.6 | |
| Submitter: | anonymous | Created on: | 2023-10-28 09:52:14 | |
| Subsystem: | 99. Other | Assigned To: | nobody | |
| Priority: | 5 Medium | Severity: | Important | |
| Status: | Closed | Last Modified: | 2023-10-28 11:50:14 | |
| Resolution: | Invalid | Closed By: | oehhar | |
| Closed on: | 2023-10-28 11:50:14 | |||
| Description: |
The tklib package getstring has a problem on windows 10 when a multi-monitor system is setup where the main monitor is to the right of a second monitor. The main monitor will then have it's upper left corner as 0,0 while the second monitor has a negative x coordinate, in the case of a 2 1080p monitors, it ends up as -1920,0.
Then when ::getstring::tk_getString tries to center its dialog, it ends up placing it far offscreen to the right, and cannot be accessed. Since there is also no window in the taskbar, one cannot move the dialog, so the program hangs waiting for input that cannot be given.
Here's the code they use:
44 if {[info exists options(-geometry)]} {
45 wm geometry $w $options(-geometry)
46 } elseif {[winfo parent $w] == "."} {
47 set x [expr {[winfo screenwidth $w]/2 - [winfo reqwidth $w]/2 - [winfo vrootx $w]}]
48 set y [expr {[winfo screenheight $w]/2 - [winfo reqheight $w]/2 - [winfo vrooty $w]}]
49 # wm geom $w +$x+$y
50 } else {
51 set t [winfo toplevel [winfo parent $w]]
52 set x [expr {[winfo width $t]/2 - [winfo reqwidth $w]/2 - [winfo vrootx $w]}]
53 set y [expr {[winfo height $t]/2 - [winfo reqheight $w]/2 - [winfo vrooty $w]}]
54 # wm geom $w +$x+$y
55 }
The problem is that winfo vrootx $w returns -1920 in my case, so we have,
result from uplevel for: ? winfo screenwidth $w ? :
?1920?
result from uplevel for: ? winfo reqwidth $w ? :
?212?
result from uplevel for: ? winfo vrootx $w ? :
?-1920?
result from uplevel for: ? expr {[winfo screenwidth $w]/2 - [winfo reqwidth $w]/2 - [winfo vrootx $w]} ? :
?2774?
this is in proc ::getstring::tk_getString {w var text args}
my workaround is to not do the wm geom, so the dialog is visible. I think not using the winfo rootx would also work.
| |||
| User Comments: |
oehhar added on 2023-10-28 11:49:45:
Thank you for the valuable ticket. This is clearly a TkLib ticket. In consequence, it was transfered here: https://core.tcl-lang.org/tklib/info/b62d4dac899af099 Thank you for all, Harald | |||
Home
Timeline
Branches
Tags
Forum
Tickets
Download
Wiki