#245 Find dialogue positioned off-screen


On a 1024x768 screen, the find dialogue (accessed
through CTRL+F) appears half off-screen, to the left.


  • Thomas E. Canter

    Logged In: YES

    I am not a password safe developer but I found this same
    To reproduce:
    1) Widen the password safe main window so that it is about
    90% of the screen width.
    2) Open the password safe Find Dialog
    3) The Find Dialog will position itself so the outer edge of the
    dialog does not overlap the main window, but the outside
    edge of the dialog will be beyond the screen edge

    The problem centers around the code that displays the Find
    Dialog. There was code that was put inplace to try to prevent
    the dialog from covering the main Password Safe screen
    when the dialog was displayed.
    Unfortunately the dialog positioning moves the dialog to the
    left or right (depending on the centering of the main window)
    of the main window, just outside the edge of the main window.
    if the distance between the main window edge and the edge
    of the screen is < the width of the Find Dialog the dialog will
    extend beyond the edge of the screen

    Have a final check after the dialog is positioned to verify that
    the dialog does not extend beyond the edge of the screen.
    if the dialog extends beyond the edge of the screen move it
    to (5 pixel boundary) the edge of the screen.

    Starting at line: 45
    if (parentWidth < (screenWidth * 9) / 10) {
    if (parentCenter < screenCenter) {
    // move right
    myRect.right = parentRect.right + myRect.right -
    myRect.left = parentRect.right;
    } else { // move left
    myRect.left = parentRect.left - (myRect.right -
    myRect.right = parentRect.left;
    //+CHANGED: Added the following section to ensure that
    the dialog does not extend beyond the edge of the screen
    if (myRect.left < 5) {
    //beyond the left edge, move right
    //Find the left edge, and move the edge 5 pixels
    //to the right of the left edge of the screen
    int curLeftoffset = -myRect.left + 5;
    myRect.left = myRect.left + curLeftoffset;
    myRect.right = myRect.right + curLeftoffset;
    } else if (myRect.right > screenWidth - 5) {
    //beyond the right edge, move left
    //Find the right edge, and move the edge 5 pixels
    //to the left of the right edge of the screen
    int curRightoffset = myRect.right - screenWidth + 5;
    myRect.left = myRect.left - curRightoffset;
    myRect.right = myRect.right - curRightoffset;
    } // parent not too wide

  • ed_

    ed_ - 2005-12-21

    Logged In: YES

    Have you thought about putting the find UI in the status
    bar? This solves all the window positioning problems, and
    takes much less space.


Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks