No announcement yet.

Keeping dialogs the same relative size

  • Filter
  • Time
  • Show
Clear All
new posts

  • Keeping dialogs the same relative size

    I have a dialog that takes up most of the screen on
    my 640 x 480 display. When I switched to 800 x 600
    however, it was much smaller (relatively).

    So, after searching the posts on the board, this
    is what I did.
    #compile exe
    #include ""
    function winmain.....
    local nScreenWidth as long
    local nScreenHeight as long
    nScreenWidth = GetSystemMetrics(%SM_CXSCREEN )
    nScreenHeight = GetSystemMetrics(%SM_CYSCREEN)

    dialog show modal....
    (all the buttone and control values are also multiplied by
    the x_offset# and y_offset also)
    This seems to work. It now looks relatively the same
    size as far as percentage of the screen area.
    If I am wrong about this let me know. thanks

    Client Writeup for the CPA

    Links Page

  • #2
    Whats wrong with keeping the window at 640x480 in an 800x600
    resolution display? Some users like to run in higher resolutions
    so they can have multiple windows visible all at once.

    Also, its going against windows conventions to scale certain
    controls with the resolution of the desktop. Buttons for instance
    should not be scaled. Other controls should only be scaled
    on the horizontal - labels and single line textboxes for instance.

    I cant think of a single application running on my machine that
    scales every window/control to the desktop resolution. Doing
    so sort of defies the whole reason for running your desktop
    at a higher resolution.




    • #3

      Whats wrong with keeping the window at 640x480 in an 800x600
      resolution display? Some users like to run in higher resolutions
      so they can have multiple windows visible all at once.

      I agree Mike, I designed all the PowerIDE dialogs at a 480x640 res, which is the bare minimum for any setup IMO, I would never scale dialogs to the current screen size - you can never guarantee correct looking results on all resolutions (unless you're doing graphics).

      I am currently using a 1024x728 pixel display (normal fonts) and it looks ok, Actually, I read somewhere that if the user wants bigger dialogs, they can change some system font (display properties) or something? You might want to check that Fred.


      Kev G Peel
      KGP Software, Bridgwater, UK. | Slam DBMS | PrpT Control | Other Downloads | Contact Me


      • #4
        Ok then here's another thought.
        If the user maximizes the window then i could set it that way.
        otherwize the offset values in normal mode would equal 1.

        What happens is (with these offsets set to 1),
        and a setting of say 800 x 600 - if you maximize it, the
        dialog goes to the full size but there is a big "open" space
        on the right.

        If I could detect %SW_MAXIMIZED AND %SW_NORMAL or something
        else appropriate then i could change it appropriately.
        Trouble is, I created this dialog (menu) as about the first
        thing i tried in PBdll 6. So all the controls have separate
        callbacks rather than having it call one callback with a
        select routine in it. any suggestions like an api call
        (which ive looked for but cant seem to find anything that
        fits the bill).


        Client Writeup for the CPA

        Links Page


        • #5
          Fred, in that case you just want to reposition the controls on
          your dialog window to fill in the space. Their is a 3rd party DLL
          available from a remarkable programmer named Lance Edmond that will
          do it all for you. He also has a downloadable demo. Check it out!

          Regards, Jules


          • #6

            Ever consider just taking the maximize button off the caption bar in your dialog so a user couldn't make the dialog any bigger than you designed it? That would eliminating the "big open space on the right", as you described it. Just make a simple change to your DIALOG NEW code. Maybe that's all you need to solve your problem.


            mailto:[email protected]
            Tsunami Record Manager


            • #7
              I made it so when it is maximized it resets the size and when it
              is put back it goes back to original size. It should increase the
              size of the font now too when you do that but I will have to
              check to see if that is working. I like the ability to make the
              menu larger so I didnt really want to remove that option from
              the dialog. Now anyway the user has the option rather than the
              program forcing a maximized state.

              Client Writeup for the CPA


              Links Page


              • #8
                In VB twips is used to size controls.
                The FreeDDT tool can also create child dialogs from VB forms.
                Your able to center this child dialog on resize.
                At least the controls are in the middle.

                We build forms with size 9600x7200 wich is 640x480 on a standard vga screen.
                If you reset your screenmode (different fontsizes etc..) you'll notice that the form is 800x600 in some resolutions.
                The perspective looks the same.
                That's the only reason i like twips.
                It's not usefull when you really need pixels as with pictures for example.

                [email protected]


                • #9
                  Guys --
                  To recalculate a size of windows is not a problem.
                  Another question, how to select a new font.

                  For example, for currect size of dialog I want to have a font 10 pixels (width) * 16 pixels (height).
                  It possible to ask Windows to build such font. But, like rule, fonts are nice with "natural" proportion.

                  Just now I use following method. At first, I ask to build a font 16 pixels height and 0 pixels width (free).

                  If average width is <= 10 pixels, I take this font.
                  If not, I ask to build 0 pixels height and 10 pixels width.

                  In this way the new font is "correct", but if it was selected the second variant, appears a wish to correct a height of elements
                  (because instead of 10 * 16 it was received, for example, 10 * 13).

                  Guys, how do you solve the problems with fonts ?

                  E-MAIL: [email protected]


                  • #10
                    Email me privately for a function demo of my RESIZE32 resizing library.

                    mailto:[email protected][email protected]</A>
                    mailto:[email protected]