Andromo - Start Making Apps - Free Signup

Announcement

Collapse
No announcement yet.

Center Window ?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Center Window ?

    Does anybody know how to center a window on the screen ? Even if the users screen is at different resolutions ??

    Thanks for any help

  • #2
    Hi. This is real easy, check out the attached example. Code is on page OnShow event and on the label's OnClick event. Hope that helps.

    Corey Milner
    Creative Director, Indigo Rose Software
    Attached Files

    Comment


    • #3
      Please don't forget there are some people using double monitor systems.
      It looks very bad if you center the window on the screen.
      One halfe is on the left monitor and the other on the right.

      Stefan
      "With a rubber duck, one's never alone."

      Douglas Adams, The Hitchhiker's Guide to the Galaxy

      Comment


      • #4
        Hi Stefan, good point, but I'm pretty sure with dual monitors your computer treats it as 2 screens, not one. So it should still work fine. Or at least I know that the old 4.0 window move action worked perfectly on my ex-Matrox with dual monitors running...

        FWIW it seems to me that the way it works is that the computer will center the window on the active screen for that window, i.e. left or right, and in the case that you have your window sitting halfway on each (which is way too rare to worry about anyhow) it choose the left screen. Or at least that's my recollection.

        Please let us know if you ever see it act otherwise somewhere.

        Corey Milner
        Creative Director, Indigo Rose Software

        Comment


        • #5
          Hi, Corey,

          this doesn' work for me.
          My screen resolution is 2560 * 1024 pixel on a matrox millennium G450 Dual Head.

          You are right, on NT4.0 there are two separate screens but on win2000 there is one great screen over two monitors.
          "With a rubber duck, one's never alone."

          Douglas Adams, The Hitchhiker's Guide to the Galaxy

          Comment


          • #6
            Hi. Odd.

            Anyhow FWIW this scenario is so rare that it's not worth planning for. This is a scenario which will occur in less than .001% of users basically, and it's a guarantee that anyone in this scenario is a tech minded individual who will be aware of the anomaly and how to get around it if need be. Or at least that's my opinion on it anyhow, I doubt you'll ever run into a end user at 2560 X 1024...

            Nonetheless it might would be easy to detect this using one extra action, i.e. just check if your screen width is more than 2.4 times your screen height, if it is, you are facing this scenario...

            Corey Milner
            Creative Director, Indigo Rose Software

            Comment


            • #7
              Doesn't work on startup ?

              Thanks everyone for you help, but I wanted this to work when my project started up....I tried the code in the Project's, Actions, Startup........But an error occurs.

              Any ideas on how to get the window to automatically center on starup of the app ????

              Thanks again.

              Comment


              • #8
                try this demo

                stefan
                Attached Files
                "With a rubber duck, one's never alone."

                Douglas Adams, The Hitchhiker's Guide to the Galaxy

                Comment

                Working...
                X