Announcement

Collapse
No announcement yet.

Window styles

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

  • Window styles

    Guys --
    What's necessary to do to have the same side borders as most windows have (PB/IDE, Imagine, Word and so on) - looks like CLIENTEDGE.
    I even took SpyXX and copied style/exstyle as hexadimal values.
    But my SDK window looks like in "incorrect" skeleton sample.

    I have impression that such effect could be due to additional WS_EX_CLIENTEDGE child window in cental part.
    Hope that it so not so.

    [This message has been edited by Semen Matusovski (edited October 11, 2001).]

  • #2
    Don't understand. Are we talking MDI dialogs? In that case, maybe because
    in MDI32.INC, client is created with %WS_EX_CLIENTEDGE style. Had to remove
    that one by hand for an MDI-based Word Processor I'm working on.

    WS_OVERLAPPEDWINDOW gives correct look for me in main app's, otherwise
    WS_CAPTION OR WS_SYSMENU usually is enough. For dialogs, that is.
    Hm, what is "incorrect" in skeleton sample?


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

    Comment


    • #3
      Borje --
      Compare left and right side of Skeleton's window with PB/IDE window.
      In skeleton they are flat. Look also bottom line of toolbar.

      Probably, DrawEdge in ERASEBKGND ?


      [This message has been edited by Semen Matusovski (edited October 11, 2001).]

      Comment


      • #4
        Since the skeleton doesn't have a MDI client window, there is no sunken border in the main window, solutions for this are...

        1. Create a static window and use that (%WS_EX_CLIENTEDGE)
        2. DrawEdge using %EDGE_SUNKEN

        In both these techniques, you must calculate main height of toolbar and status bar, hence creating the main window with %WS_EX_CLIENTEDGE won't look correct.

        Is that what you mean?



        ------------------
        Kev G Peel
        KGP Software, Bridgwater, UK.
        mailto:[email protected][email protected]</A>
        kgpsoftware.com | Slam DBMS | PrpT Control | Other Downloads | Contact Me

        Comment


        • #5
          Both Pb/ide & Skeleton dosn't have %WS_EX_CLIENTEDGE style.

          In PB/Ide the white rectangle is another window with the %WS_EX_CLIENTEDGE
          while in skeleton only the background are painted white


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

          Comment


          • #6
            I manufactured some code (for the lurkers), simply add to skeleton.bas and leave to simmer for 1 second...

            Code:
             
                Case %WM_ERASEBKGND: Function = 1: Exit Function
             
                Case %WM_PAINT
                     Local hDc As Long, rc As RECT, rc2 As RECT
                     Function = DefWindowProc(hWnd, wMsg, wParam, lParam)
                     hDc = GetDc(hWnd)
                     GetClientRect hWnd, rc
                     GetClientRect hStatus, rc2
                     rc.nBottom = rc.nBottom - rc2.nBottom
                     GetClientRect hToolbar, rc2
                     rc.nTop = rc.nTop + rc2.nBottom + 2
                     FillRect hDc, rc, GetSysColorBrush(%COLOR_APPWORKSPACE)
                     DrawEdge hDc, rc, %EDGE_SUNKEN, %BF_RECT
                     ReleaseDc hWnd, hDc
                     Exit Function
            ------------------
            Kev G Peel
            KGP Software, Bridgwater, UK.
            mailto:[email protected][email protected]</A>
            kgpsoftware.com | Slam DBMS | PrpT Control | Other Downloads | Contact Me

            Comment


            • #7
              Think better to use Begin/EndPain in WM_PAINT, like:
              Code:
                 Case %WM_ERASEBKGND: Function = 1: Exit Function
               
                 Case %WM_PAINT
                      Local rc As RECT, rc2 As RECT, ps AS PAINTSTRUCT
               
                      BeginPaint hWnd, ps
                         GetClientRect hWnd, rc
                         GetClientRect hStatus, rc2
                         rc.nBottom = rc.nBottom - rc2.nBottom
                         GetClientRect hToolbar, rc2
                         rc.nTop = rc.nTop + rc2.nBottom + 2
                         FillRect ps.hDc, rc, GetSysColorBrush(%COLOR_WINDOW)
                         DrawEdge ps.hDc, rc, %EDGE_SUNKEN, %BF_RECT
                      EndPaint hWnd, ps
                      FUNCTION = 0 : Exit Function
              Also, can add %WS_THICKFRAME style to CreateToolbarEx, to give toolbar
              own borders, but not needed with Kev's solution.


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

              Comment


              • #8
                Semen,

                The PBNOTE.BAS example that came with PB/DLL 5.0 is an MDI that shows
                the same client edge. In addition the child windows also have the same
                client edge, so when you maximize the child, you see double edge'ing.

                In the past I made my own MDI using Parent/client and child windows. In
                my code adding the clientedge style to my client(only border) window gives
                this effect.

                Regards,
                Jules
                Best regards
                Jules
                www.rpmarchildon.com

                Comment


                • #9
                  Thanx, guys.

                  DrawEdge looks like alone simple solution.
                  Meanwhile calculations + 2 confuses me.
                  In similar cases I use GetWindowRect
                  Code:
                     GetClientRect hWnd, rc
                     GetWindowRect hWndStatus, rc2
                     rc.nBottom = rc.nBottom - (rc2.nBottom - rc2.nTop)
                     GetWindowRect hWndTB, rc2
                     rc.nTop = rc.nTop + (rc2.nBottom - rc2.nTop)

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

                  Comment

                  Working...
                  X