Loading ...
Sorry, an error occurred while loading the content.

Re: Converting CSplitterWindow to CHorSplitterWindow?

Expand Messages
  • Nikos Bozinis
    ... child ... to a ... the way i ve done it was modifying atlsplit.h turning t_bVertical from a template to a real variable. THere are a few places in the code
    Message 1 of 11 , Nov 1, 2004
    View Source
    • 0 Attachment
      --- In wtl@yahoogroups.com, "Bill Holt" <billholtsh@m...> wrote:
      >
      > I wanted to offer the option to customize the layout of one of the
      child
      > windows in a WTL-based program, either split-vertically or
      > split-horizontally. So is it possible to convert a CSplitterWindow
      to a
      > CHorSplitterWindow? Or the only way is to have them both declared?
      >

      the way i've done it was modifying atlsplit.h turning t_bVertical
      from a template to a real variable. THere are a few places in the
      code that need attention too but overall it's quite easy to convert
      and add a SetPaneOrientation() method to change things while the
      window is active

      hth
      nikos

      ----
      www.zabkat.com
    • Bill Holt
      Thanks for your reply Nikos. Actually I didn t understand why the vertical boolean is designed as a template parameter. People would have a lot of needs to
      Message 2 of 11 , Nov 1, 2004
      View Source
      • 0 Attachment
        Thanks for your reply Nikos. Actually I didn't understand why the vertical
        boolean is designed as a template parameter. People would have a lot of
        needs to convert between them.

        I'll try to rebuild this class.

        Regards,
        Bill

        >From: "Nikos Bozinis" <umeca74@...>
        >Reply-To: wtl@yahoogroups.com
        >To: wtl@yahoogroups.com
        >Subject: [wtl] Re: Converting CSplitterWindow to CHorSplitterWindow?
        >Date: Mon, 01 Nov 2004 09:21:11 -0000
        >

        _________________________________________________________________
        Express yourself instantly with MSN Messenger! Download today it's FREE!
        http://messenger.msn.com/


        [Non-text portions of this message have been removed]
      • Roger Headrick
        ... vertical ... lot of ... Hi Bill, Consistent with the approach suggested by Nikos, here is a class method to change to splitter orientation at runtime.
        Message 3 of 11 , Nov 1, 2004
        View Source
        • 0 Attachment
          --- In wtl@yahoogroups.com, "Bill Holt" <billholtsh@m...> wrote:
          > Thanks for your reply Nikos. Actually I didn't understand why the
          vertical
          > boolean is designed as a template parameter. People would have a
          lot of
          > needs to convert between them.
          >
          > I'll try to rebuild this class.
          >
          > Regards,
          > Bill
          >

          Hi Bill,

          Consistent with the approach suggested by Nikos, here is a class
          method to change to splitter orientation at runtime. m_bVertical is
          a bool class data member which is used instead of the t_bVertical
          template parameter.

          void SetOrientation(bool bVertical, bool bUpdate = true)
          {
          if (m_bVertical == bVertical) return;

          m_bVertical = bVertical;

          m_hCursor = ::LoadCursor(NULL, m_bVertical ? IDC_SIZEWE :
          IDC_SIZENS);

          if (m_xySplitterPos > 0)
          {
          int nMul = m_bVertical ? m_rcSplitter.right: m_rcSplitter.bottom;
          int nDiv = m_bVertical ? m_rcSplitter.bottom: m_rcSplitter.right;
          if (nDiv > 0)
          m_xySplitterPos = ::MulDiv(m_xySplitterPos, nMul, nDiv);
          }

          if (bUpdate)
          {
          T* pT = static_cast<T*>(this);
          if ((pT->m_hWnd != NULL) && ::IsWindow(pT->m_hWnd))
          {
          UpdateSplitterLayout();
          }
          }
          }


          -Roger
        • Bill Holt
          Thank you Roger. It s now working pretty good. Except for one thing, do I need to destroy the cursor before loading a new one? Bill ...
          Message 4 of 11 , Nov 1, 2004
          View Source
          • 0 Attachment
            Thank you Roger. It's now working pretty good. Except for one thing, do I
            need to destroy the cursor before loading a new one?

            Bill

            >From: "Roger Headrick" <lilsroro@...>
            >Reply-To: wtl@yahoogroups.com
            >To: wtl@yahoogroups.com
            >Subject: [wtl] Re: Converting CSplitterWindow to CHorSplitterWindow?
            >Date: Mon, 01 Nov 2004 13:29:52 -0000
            >

            _________________________________________________________________
            Express yourself instantly with MSN Messenger! Download today it's FREE!
            http://messenger.msn.com/


            [Non-text portions of this message have been removed]
          • Roger Headrick
            ... thing, do I ... I assumed the cursor is a shared cursor and shouldn t be destroyed according to MSDN docs on the DestroyCursor function. Also, I noticed
            Message 5 of 11 , Nov 1, 2004
            View Source
            • 0 Attachment
              --- In wtl@yahoogroups.com, "Bill Holt" <billholtsh@m...> wrote:
              > Thank you Roger. It's now working pretty good. Except for one
              thing, do I
              > need to destroy the cursor before loading a new one?
              >
              > Bill
              >

              I assumed the cursor is a "shared" cursor and shouldn't be destroyed
              according to MSDN docs on the DestroyCursor function. Also, I
              noticed that the original splitter classes do not destroy the cursor
              when the last class instance is destructed, even though it loads the
              cursor in the constructor. If this is a problem - a resource leak -
              then the original classes also have a leak.

              Also, in my new splitter class, I changed the m_hCursor variable so
              that it is not static, and I load the cursor in my OnCreate handler
              rather than in the constructor.

              In OnCreate:

              if (m_hCursor == NULL)
              m_hCursor = ::LoadCursor(NULL, m_bVertical ? IDC_SIZEWE :
              IDC_SIZENS);

              -Roger
            • Nikos Bozinis
              note the cursor will have to be re-loaded every time there s a change of orientation ... destroyed ... cursor ... the
              Message 6 of 11 , Nov 1, 2004
              View Source
              • 0 Attachment
                note the cursor will have to be re-loaded every time there's a change
                of orientation

                --- In wtl@yahoogroups.com, "Roger Headrick" <lilsroro@y...> wrote:
                >
                > --- In wtl@yahoogroups.com, "Bill Holt" <billholtsh@m...> wrote:
                > > Thank you Roger. It's now working pretty good. Except for one
                > thing, do I
                > > need to destroy the cursor before loading a new one?
                > >
                > > Bill
                > >
                >
                > I assumed the cursor is a "shared" cursor and shouldn't be
                destroyed
                > according to MSDN docs on the DestroyCursor function. Also, I
                > noticed that the original splitter classes do not destroy the
                cursor
                > when the last class instance is destructed, even though it loads
                the
                > cursor in the constructor. If this is a problem - a resource leak -

                > then the original classes also have a leak.
                >
                > Also, in my new splitter class, I changed the m_hCursor variable so
                > that it is not static, and I load the cursor in my OnCreate handler
                > rather than in the constructor.
                >
                > In OnCreate:
                >
                > if (m_hCursor == NULL)
                > m_hCursor = ::LoadCursor(NULL, m_bVertical ? IDC_SIZEWE :
                > IDC_SIZENS);
                >
                > -Roger
              • Roger Headrick
                ... change ... Hi Nikos, The SetOrientation method I previously posted for Bill includes a LoadCursor call. I m 99% sure that the previous cursor does not
                Message 7 of 11 , Nov 1, 2004
                View Source
                • 0 Attachment
                  --- In wtl@yahoogroups.com, "Nikos Bozinis" <umeca74@h...> wrote:
                  >
                  > note the cursor will have to be re-loaded every time there's a
                  change
                  > of orientation
                  >

                  Hi Nikos,

                  The SetOrientation method I previously posted for Bill includes a
                  LoadCursor call. I'm 99% sure that the previous cursor does not
                  need to be destroyed with DestroyCursor.

                  -Roger
                • Nikos Bozinis
                  ... sorry roger, i missed that your code is immaculate as usual :)
                  Message 8 of 11 , Nov 1, 2004
                  View Source
                  • 0 Attachment
                    --- In wtl@yahoogroups.com, "Roger Headrick" <lilsroro@y...> wrote:
                    >
                    > The SetOrientation method I previously posted for Bill includes a
                    > LoadCursor call. I'm 99% sure that the previous cursor does not
                    > need to be destroyed with DestroyCursor.
                    >
                    > -Roger

                    sorry roger, i missed that
                    your code is immaculate as usual :)
                  • Miguel Hasse de Oliveira
                    Take a look at my modified implementaion of the wtl splitter... I ve made it available at the WTL group files:
                    Message 9 of 11 , Nov 2, 2004
                    View Source
                    • 0 Attachment
                      Take a look at my modified implementaion of the wtl splitter... I've made it
                      available at the WTL group files:

                      http://groups.yahoo.com/group/wtl/files/atlsplit2.zip

                      Hope you like it.

                      Miguel Hasse


                      -----Original Message-----
                      From: Bill Holt [mailto:billholtsh@...]
                      Sent: sábado, 30 de Outubro de 2004 8:42
                      To: wtl@yahoogroups.com
                      Subject: [wtl] Converting CSplitterWindow to CHorSplitterWindow?


                      Hi Folks,

                      I wanted to offer the option to customize the layout of one of the child
                      windows in a WTL-based program, either split-vertically or
                      split-horizontally. So is it possible to convert a CSplitterWindow to a
                      CHorSplitterWindow? Or the only way is to have them both declared?

                      Best regards,
                      Bill Holt

                      _________________________________________________________________
                      Don't just search. Find. Check out the new MSN Search!
                      http://search.msn.com/





                      Yahoo! Groups Links
                    • Bill Holt
                      Thanks, it looks great. And it features a snapping function, that s another practical one! Best regards, Bill ...
                      Message 10 of 11 , Nov 2, 2004
                      View Source
                      • 0 Attachment
                        Thanks, it looks great. And it features a snapping function, that's another
                        practical one!

                        Best regards,
                        Bill

                        >From: "Miguel Hasse de Oliveira" <maaho@...>
                        >Reply-To: wtl@yahoogroups.com
                        >To: <wtl@yahoogroups.com>
                        >Subject: RE: [wtl] Converting CSplitterWindow to CHorSplitterWindow?
                        >Date: Tue, 2 Nov 2004 19:53:56 -0000
                        >

                        _________________________________________________________________
                        Express yourself instantly with MSN Messenger! Download today it's FREE!
                        http://messenger.msn.com/


                        [Non-text portions of this message have been removed]
                      Your message has been successfully submitted and would be delivered to recipients shortly.