Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^2: Tk multiple monitor problem

by JohnRS (Scribe)
on Mar 10, 2012 at 11:39 UTC ( [id://958853]=note: print w/replies, xml ) Need Help??


in reply to Re: Tk multiple monitor problem
in thread Tk multiple monitor problem

Yes, from what I gather, the problem with Show is that the check to make sure that it places popups in viewable area fails because the test doesn't realize that there is a left monitor. This is somewhat odd considering that you can use the geometry command to put the main window there.

Indeed, I have come up with a work around. It's tacky, but it works. Rather than fight Show's limitation, I use it as is, letting it place the popup incorrectly. Then I use a geometry command to move the popup to where it should be. Since your code stops running after the Show, I came up with the following way to accomplish this. Immediately prior to the Show I added the following.

$mw->after(2, \&Popup_Position_Fix, $popup, $popover);

The Popup_Position_Fix routine does some calculating then executes a geometry command on the popup. As I said, tacky, but it works. :)

Replies are listed 'Best First'.
Re^3: Tk multiple monitor problem
by Anonymous Monk on Mar 10, 2012 at 12:07 UTC

    As long as it works, tacky is beautiful :) but grepping through the source, -popover should have worked, go figure

    Tk/DialogBox.pm

    Tk/Wm.pm

      I did look at DialogBox.pm and a few others. This is why I feld that probably the Show routine was at fault. I did not know where to find Popup till your message, however. In Wm.pm I now see it. Indeed, this part of it would appear to cause the problem.

      # adjust to not cross screen borders if ($X < 0) { $X = 0 }

      Unfortunately, when I change this line my code runs the same. So I'm mystified.

      Also in Wm.pm I noted the Post routine. It contains this.

      $w->geometry("+$X+$Y"); # $w->MoveToplevelWindow($X,$Y);

      I'm guessing that the commented out MoveToplevelWindow call was replaced by the one to geometry (which works OK on multiple monitors).

      Thanks for the leads, however. :)

        Just curious -- I take it the 'withdraw' does not work?

        Elda Taluta; Sarks Sark; Ark Arks
        My deviantART gallery

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://958853]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2024-04-19 05:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found