Announcement

Collapse
No announcement yet.

Dialog Units...uhhhhh...

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

  • #21
    It's enough to replace Dialog New and Dialog Show by own subroutines and appears full freedom.
    Just my 2 cop. = 0,06 c (not more)



    ------------------

    Comment


    • #22
      Lance;

      The above code I posted that uses GetDeviceCaps returns the custom font size value as well.

      Small Fonts = 96 (pixels/Inch)
      Large Fonts = 120 (pixels/inch) (which is 125% of 96)

      If a custom Font size is selected , the pixels/inch value is returned.

      The reason for using this function, is that sometimes you may not want Windows to autoscale your Forms/Fonts. Autoscaling may not always be wanted.

      A problem occurs with autoscaling of Fonts, when you create a Dialog that is not autoscaled, but the fonts get scaled and the text is too big for the buttons.

      Some who write apps using SDK style code or EZxxx (dreaded E word) may create Windows that are not autosized, like Dilaogs are. If the Fonts get autosized, then they may be too big for the controls (like Buttons). There needs to be a way to "force" Windows to not autosize the Fonts.

      As it turns out, the GetDeviceCaps function is used in the "pre-calculation" of the logical Font size (convert from Points (1/72 inch) to Logical Units for the CreateFont function) and this makes your fonts "autoscaled". By substituting the value 96 (smallfonts) for the return value of GetDeviceCaps, your fonts will not be autoscaled.

      While some apss may be better having autoscaling, some apps may not look right. What happens if you create a Window that has lots of controls and was designed to fill an 800 x 600 screen. If it got autosized, it would be bigger than the screen. While smaller popup Dialogs won't be a problem with autosizing, Dialogs that use the entire screen (like a Data input screen for a business app), would be too large.

      IMO, it is better to give the programmer the choice to allow autosizing or not.




      ------------------
      Chris Boss
      Computer Workshop
      Developer of "EZGUI"
      http://cwsof.com
      http://twitter.com/EZGUIProGuy

      Comment


      • #23
        Chris --

        Here is an interesting MSDN page, called "Large Fonts Versus Small Fonts Use in Windows".

        http://support.microsoft.com/support.../Q177/7/95.ASP

        Here is a pertinent quote: "Applications should not attempt to determine the system font size since there is no reliable way to obtain the information.

        Also: LOGPIXELSX and LOGPIXELSY values (...) not reliable...

        -- Eric

        ------------------
        Perfect Sync: Perfect Sync Development Tools
        Email: mailto:[email protected][email protected]</A>

        "Not my circus, not my monkeys."

        Comment


        • #24
          Eric;

          Thank You !

          The MS Docs are very informative !

          From what I read, it almost appears that "any" use of Screen Units (Pixels) for designing a Dialog is a No, No.

          This seems very strange to me, since Dialog Units don't translate exactly to an exact number of pixels (1 to 1 correlation), which is what is needed for accuracy at times.

          The only "accurate" Units, I can think of would be "Twips" since they are so much smaller than Pixels, that they would convert well to pixels.

          Twips are 1440 Units per Inch.

          The standard display uses 96 pixels per "Logical Inch", so you would have 15 Twips per Pixel.

          So there may be evidence of the value in using Twips after all.

          Obviusly there must be some valid reason for using Twips, because Twips are the default coordinate system for Visual Basic. Even when you use a Scalemode of Pixels in a VB Form, the Forms code (in the FRM file) still uses Twips for Units (not Pixels).

          VB Forms do autosize, based on the system Font Size (large or small), just like Dialogs do.

          From what I am learning, I may even seriously consider changing the coordinate system in EZGUI 2.0.



          ------------------
          Chris Boss
          Computer Workshop
          Developer of "EZGUI"
          http://cwsof.com
          http://twitter.com/EZGUIProGuy

          Comment


          • #25
            Ignoring VB for the moment... Off the top of my head (and without knowing for sure) I'd speculate that the default scaling unit for Visual C++ is Dialog Units, since the Visual Studio resource editor is used for creating a UI. And the Win32 API works with Dialog Units, as does DDT... IMO, EZGUI should use Dialog Units, not Twips. Twips are more of a printer thing.

            Just my opinion.

            -- Eric

            ------------------
            Perfect Sync: Perfect Sync Development Tools
            Email: mailto:[email protected][email protected]</A>

            "Not my circus, not my monkeys."

            Comment


            • #26
              Thanks for the info Eric !

              I have already modified the EZGUI 1.1 beta (which will be EZGUI 2.0 when released) to take advantage of Dialog Units.

              EZGUI uses a Character based coordinate system, but version was defining the character size as 8 x 16 pixels (which could be changed in code).

              EZGUI 2.0 will use a character size which is "calculated" based on Dialog Units.

              A Dialog Unit is:

              (Horz.) 1/4 of average width of Dialogs font
              (Vert.) 1/8 of height of Dialogs font

              Dialogs Units are based on the average width amd height of the Dialogs font, so EZGUI 2.0 will use a Character size of:

              (Horz.) 4 Dialog Units
              (Vert.) 8 Dialog Units

              EZGUI defines the Character Coordinates as real numbers, so you can define a coordinate of say .25 which would be 1 Dialog Unit (Horz.). This will allow using Dialog Units (actually Dialog Characters) for autoscaling, but it will allow greater precision.

              Thanks for all the info, since it will help me make a better product and it will help me have better compatibility with DDT. My DDT Visual Designer is an EZGUI app, so the new autoscaling based on Dialog Units will be necessary for DDT Dialog Design.



              ------------------
              Chris Boss
              Computer Workshop
              Developer of "EZGUI"
              http://cwsof.com
              http://twitter.com/EZGUIProGuy

              Comment

              Working...
              X