Announcement

Collapse
No announcement yet.

Creating windows by a needed client size ????

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

  • Creating windows by a needed client size ????

    Hi PB Users;

    I have a question:

    It is easy to create a window by the size of the entire window. What I need is the ability to calculate the needed size of my client area (which will vary) and then figure out how much bigger the actual window will have to be (including title bar and dialog frame and menu ), so my client area is the correct size.

    Lets, say I need my cient area to be 600 X 400 pixels. How would I calculate the extra needed for the Title bar, dialog frame and menu, so I can send the correct size for the window to CreatewindowEX ? Lets say the title bar added 16 pixels, the frame 6 pixels on all sides and the menu 16 pixels. If I needed a 600 x 400 client area, then window would have to be (600 + 6 + 6) x (400 + 6 + 6 + 16 + 16)

    or 612 x 448

    Do you get it ?

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

  • #2
    Sure i get it, you'll need a hidden window to determine caption height.
    Yes i know getsystemmetric can help you out but, what if the topmenu is spread out over multiple rows?

    Use clientToscreen to determine height of client <> top of window, same with the border..


    Comment


    • #3
      Create your window any size.

      In your WM_INITDIALOG (or WM_CREATE) handler, call GetClientRect() to get the size of the client area. Subtract the current height from the height you want and add it to the size of the whole window in a MoveWindow call. Off the top of my head...:
      Code:
      CASE %WM_INITDIALOG
        GetWindowRect wr
        GetClientRect cr
        x  = wr.nLeft
        y  = wr.nTop
        xx = (wr.nRight - wr.nLeft) + (DesiredX - (cr.nRight - cr.nLeft))
        yy = (wr.nBottom - wr.nTop) + (DesiredY - (cr.nBottom - ct.nTop))
        MoveWindow hWnd, x, y, xx, yy, %TRUE
      --Dave
      Home of the BASIC Gurus
      www.basicguru.com

      Comment


      • #4
        Is there a similar method with a console program?


        ------------------
        How long is an idea?

        Comment


        • #5
          AdjustWindowRect ??


          ------------------
          http://www.hellobasic.com
          hellobasic

          Comment


          • #6
            Don't know how everybody finds this stuff!
            I need an index to the index.



            ------------------
            How long is an idea?

            Comment


            • #7
              The console client size is determined by the console font. The window can be resized lower with the automatic introduction of scrollbars within the console.

              Mike, what exactly do you want to achieve?



              ------------------
              Lance
              PowerBASIC Support
              mailto:[email protected][email protected]</A>
              Lance
              mailto:[email protected]

              Comment


              • #8
                Sorry, thought it was a new request..

                ------------------
                http://www.hellobasic.com
                hellobasic

                Comment


                • #9
                  Would like to stay in windowed mode and leave a 1-line
                  task bar at any screen resolution.


                  ------------------
                  How long is an idea?

                  Comment


                  • #10
                    Console Tools offers a mode to maximize the console to cover as much of the work-area as possible (I believe):
                    Code:
                    ConsoleWindow  %SHOWMAXIMIZED
                    However, the ability for the console window to completely cover the work-area depends on the font being used and the OS platform. As I understand it, under Win9x and with Courier New being used, ConsoleWindow %SHOWMAXIMIZED will fill the work area.

                    I'm sure Eric Pearson will correct or expand on this exxplanation if necessary.

                    ------------------
                    Lance
                    PowerBASIC Support
                    mailto:[email protected][email protected]</A>
                    Lance
                    mailto:[email protected]

                    Comment


                    • #11
                      > ConsoleWindow %SHOWMAXIMIZED
                      I see terrible combination in my program
                      Code:
                      ConsoleToForeground %Soft
                      ConsoleToForeground %Hard
                      ConsoleTopMost %True
                      ConsoleStretch
                      Unf., console should be topmost, because in some OSes task bar overwrites "stretched" window (unlike GUI).
                      %Soft is necessary also (I know one situation under 9x)



                      ------------------
                      E-MAIL: [email protected]

                      Comment

                      Working...
                      X