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

TabCtrl windows 2000

Expand Messages
  • Fredrik Axelsson
    Hello Everyone! I have two questions regarding CTabCtrl: 1. I m using the CTabCtrl derived class in my view window to dispaly different dialogs on each tab.
    Message 1 of 10 , Aug 1, 2004
    • 0 Attachment
      Hello Everyone!

      I have two questions regarding CTabCtrl:

      1. I'm using the CTabCtrl derived class in my view window to dispaly
      different dialogs on each tab. Everything is working fine while using
      windows xp (and/or wine) but when my friend tried my program on his
      windows 2000 machine one of the dialogs won't draw.

      I have posted the relevant parts of my WM_CREATE handler and my
      TCN_SELCHANGE handler below.

      The dialogs are both transparent Child dialogs without border or client
      edge.

      2. I would really like to be able to use Resizeable dialogs on the
      TabCtrls but my efforts so far has been in wane. I tried using a
      resizeable border and make the classes derive from CDialogResize, I also
      provided a resize map for the controls on the dialogs. The dialogs won't
      resize even though I tried to handle the WM_SIZE message in the TabCtrl
      class and MoveWindow to position the dialogs correctly on the tabctrl.

      If anyone can shed some light on these questions I'd be mighty grateful=)

      Best Regards,

      Fredrik
    • Fredrik Axelsson
      Opps, forgot the attachment! ... LRESULT CTabView::OnCreate(UINT uMsg, WPARAM wParam,LPARAM lParam, BOOL& /*bHandled*/) { LRESULT lRet = DefWindowProc(uMsg,
      Message 2 of 10 , Aug 1, 2004
      • 0 Attachment
        Opps, forgot the attachment!

        ----------

        LRESULT CTabView::OnCreate(UINT uMsg, WPARAM wParam,LPARAM lParam, BOOL& /*bHandled*/)
        {
        LRESULT lRet = DefWindowProc(uMsg, wParam, lParam);

        ATLASSERT(::IsWindow(m_hWnd)); //OK
        TCITEM item;
        int i;
        item.mask = TCIF_TEXT;
        item.pszText = _T("Summary");m_plrSecondDialog
        i = InsertItem(0, &item); //returns zero
        item.pszText = _T("Seen Hands");
        i = InsertItem(1, &item); //returns zero :(

        RECT rcAdjust={0};
        AdjustRect(false,&rcAdjust);
        HWND hwnd=m_plrDialog.Create(m_hWnd,rcDefault,0);

        m_plrDialog.ShowWindow(SW_SHOW);

        RECT rcDiag = {0};
        m_plrFirstDialog.GetClientRect(&rcDiag);
        m_plrFirstDialog.MoveWindow(rcAdjust.left,rcAdjust.top,rcDiag.right-rcDiag.left,rcDiag.bottom-rcDiag.top,true);

        HWND hwnd_hands= m_plrSecondDialog.Create(m_hWnd,rcDefault,0);

        m_plrSecondDialog.GetClientRect(&rcDiag);
        m_plrSecondDialog.MoveWindow(rcAdjust.left,rcAdjust.top,rcDiag.right-rcDiag.left,rcDiag.bottom-rcDiag.top,true);
        m_plrSecondDialog.ShowWindow(SW_HIDE);

        return lRet;
        }

        LRESULT CTabView::OnSelChange(int id,void*,BOOL &bHandled)
        {
        int i=GetCurSel();
        if(i==0){
        m_plrSecondDialog.ShowWindow(SW_HIDE);
        m_plrFirstDialog.ShowWindow(SW_SHOW);
        }else{
        m_plrFirstDialog.ShowWindow(SW_HIDE);
        m_plrSecondDialog.ShowWindow(SW_SHOW);
        }
        bHandled = TRUE;
        return 0;
        }



        [Non-text portions of this message have been removed]
      • Fredrik Axelsson
        Gmane stole my attatchment, or I just messed up:) ... LRESULT CTabView::OnCreate(UINT uMsg, WPARAM wParam,LPARAM lParam, BOOL& /*bHandled*/) { LRESULT lRet =
        Message 3 of 10 , Aug 1, 2004
        • 0 Attachment
          Gmane stole my attatchment, or I just messed up:)

          ----------

          LRESULT CTabView::OnCreate(UINT uMsg, WPARAM wParam,LPARAM lParam, BOOL& /*bHandled*/)
          {
          LRESULT lRet = DefWindowProc(uMsg, wParam, lParam);

          ATLASSERT(::IsWindow(m_hWnd)); //OK
          TCITEM item;
          int i;
          item.mask = TCIF_TEXT;
          item.pszText = _T("Summary");m_plrSecondDialog
          i = InsertItem(0, &item); //returns zero
          item.pszText = _T("Seen Hands");
          i = InsertItem(1, &item); //returns zero :(

          RECT rcAdjust={0};
          AdjustRect(false,&rcAdjust);
          HWND hwnd=m_plrDialog.Create(m_hWnd,rcDefault,0);

          m_plrDialog.ShowWindow(SW_SHOW);

          RECT rcDiag = {0};
          m_plrFirstDialog.GetClientRect(&rcDiag);
          m_plrFirstDialog.MoveWindow(rcAdjust.left,rcAdjust.top,rcDiag.right-rcDiag.left,rcDiag.bottom-rcDiag.top,true);

          HWND hwnd_hands= m_plrSecondDialog.Create(m_hWnd,rcDefault,0);

          m_plrSecondDialog.GetClientRect(&rcDiag);
          m_plrSecondDialog.MoveWindow(rcAdjust.left,rcAdjust.top,rcDiag.right-rcDiag.left,rcDiag.bottom-rcDiag.top,true);
          m_plrSecondDialog.ShowWindow(SW_HIDE);

          return lRet;
          }

          LRESULT CTabView::OnSelChange(int id,void*,BOOL &bHandled)
          {
          int i=GetCurSel();
          if(i==0){
          m_plrSecondDialog.ShowWindow(SW_HIDE);
          m_plrFirstDialog.ShowWindow(SW_SHOW);
          }else{
          m_plrFirstDialog.ShowWindow(SW_HIDE);
          m_plrSecondDialog.ShowWindow(SW_SHOW);
          }
          bHandled = TRUE;
          return 0;
          }



          [Non-text portions of this message have been removed]
        • John D. Wilkinson, III
          The list does not accept attachments. They are stripped when the message arrives. Two reasons: security, and the fact that Yahoo does not store the
          Message 4 of 10 , Aug 1, 2004
          • 0 Attachment
            The list does not accept attachments. They are stripped when the
            message arrives. Two reasons: security, and the fact that Yahoo does
            not store the attachments along with the original e-mail (so they are of
            use only to current subscribers, and make the archives somewhat less
            useful).

            If you want to send a file, you can use the group files area at [1].

            John

            [1] http://groups.yahoo.com/group/wtl/files


            -----Original Message-----
            From: news [mailto:news@...] On Behalf Of Fredrik Axelsson
            Sent: Sunday, August 01, 2004 12:29 PM
            To: wtl@yahoogroups.com
            Subject: [wtl] Re: TabCtrl windows 2000

            Opps, forgot the attachment!

            ----------

            LRESULT CTabView::OnCreate(UINT uMsg, WPARAM wParam,LPARAM lParam, BOOL&
            /*bHandled*/)
            {
            LRESULT lRet = DefWindowProc(uMsg, wParam, lParam);

            ATLASSERT(::IsWindow(m_hWnd)); //OK
            TCITEM item;
            int i;
            item.mask = TCIF_TEXT;
            item.pszText = _T("Summary");m_plrSecondDialog
            i = InsertItem(0, &item); //returns zero
            item.pszText = _T("Seen Hands");
            i = InsertItem(1, &item); //returns zero :(

            RECT rcAdjust={0};
            AdjustRect(false,&rcAdjust);
            HWND hwnd=m_plrDialog.Create(m_hWnd,rcDefault,0);

            m_plrDialog.ShowWindow(SW_SHOW);

            RECT rcDiag = {0};
            m_plrFirstDialog.GetClientRect(&rcDiag);

            m_plrFirstDialog.MoveWindow(rcAdjust.left,rcAdjust.top,rcDiag.right-rcDi
            ag.left,rcDiag.bottom-rcDiag.top,true);

            HWND hwnd_hands= m_plrSecondDialog.Create(m_hWnd,rcDefault,0);

            m_plrSecondDialog.GetClientRect(&rcDiag);

            m_plrSecondDialog.MoveWindow(rcAdjust.left,rcAdjust.top,rcDiag.right-rcD
            iag.left,rcDiag.bottom-rcDiag.top,true);
            m_plrSecondDialog.ShowWindow(SW_HIDE);

            return lRet;
            }

            LRESULT CTabView::OnSelChange(int id,void*,BOOL &bHandled)
            {
            int i=GetCurSel();
            if(i==0){
            m_plrSecondDialog.ShowWindow(SW_HIDE);
            m_plrFirstDialog.ShowWindow(SW_SHOW);
            }else{
            m_plrFirstDialog.ShowWindow(SW_HIDE);
            m_plrSecondDialog.ShowWindow(SW_SHOW);
            }
            bHandled = TRUE;
            return 0;
            }



            [Non-text portions of this message have been removed]





            Yahoo! Groups Links





            ---
            Incoming mail is certified Virus Free.
            Checked by AVG anti-virus system (http://www.grisoft.com).
            Version: 6.0.727 / Virus Database: 482 - Release Date: 7/26/2004


            ---
            Outgoing mail is certified Virus Free.
            Checked by AVG anti-virus system (http://www.grisoft.com).
            Version: 6.0.727 / Virus Database: 482 - Release Date: 7/26/2004
          • Jim Barry
            ... This should work all right, but you do need to chain messages to CDialogResize by adding a CHAIN_MSG_MAP entry to each dialog s message map. You will also
            Message 5 of 10 , Aug 1, 2004
            • 0 Attachment
              Fredrik Axelsson wrote:
              > 2. I would really like to be able to use Resizeable dialogs on the
              > TabCtrls but my efforts so far has been in wane. I tried using a
              > resizeable border and make the classes derive from CDialogResize, I also
              > provided a resize map for the controls on the dialogs. The dialogs won't
              > resize even though I tried to handle the WM_SIZE message in the TabCtrl
              > class and MoveWindow to position the dialogs correctly on the tabctrl.

              This should work all right, but you do need to chain messages to CDialogResize by adding a CHAIN_MSG_MAP entry to each dialog's message map. You will also need to call DlgResize_Init during each dialog's WM_INITDIALOG handler, and I recommend specifying false for the bAddGripper parameter. You can lose the resizing border too.

              --
              Jim Barry, MVP for Windows SDK
            • Fredrik Axelsson
              Thanks John! But the file I posted seems to be visible everywhere now:) It s not supposed to be a complete file. I just posted it as an attachment because it
              Message 6 of 10 , Aug 1, 2004
              • 0 Attachment
                Thanks John!

                But the file I posted seems to be visible everywhere now:) It's not
                supposed to be a complete file. I just posted it as an attachment
                because it wouldn't indent correctly with my email client.

                The code is from my WM_CREATE and TCN_SELCHANGE message handlers of the
                tabctrl derived class. What I'm specifically interested in understanding
                is why one of the dialogs (called m_plrSecondDialog) wont display at all
                using Windows 2000 but displays just fine on Windows XP. I can't access
                any windows 2000 machine myself so I can't easily figure it out.

                Best Regards,

                Fredrik



                John D. Wilkinson, III wrote:
                > The list does not accept attachments. They are stripped when the
                > message arrives. Two reasons: security, and the fact that Yahoo does
                > not store the attachments along with the original e-mail (so they are of
                > use only to current subscribers, and make the archives somewhat less
                > useful).
                >
                > If you want to send a file, you can use the group files area at [1].
                >
                > John
              • Fredrik Axelsson
                ... Thanks Jim! It works:) Like you suspected, I forgot to chain the messagemap to DialogResize. But it really flickers a lot, I m not really sure how to
                Message 7 of 10 , Aug 1, 2004
                • 0 Attachment
                  Jim Barry wrote:

                  > Fredrik Axelsson wrote:
                  >
                  >>2. I would really like to be able to use Resizeable dialogs on the
                  >>TabCtrls but my efforts so far has been in wane. I tried using a
                  >>resizeable border and make the classes derive from CDialogResize, I also
                  >>provided a resize map for the controls on the dialogs. The dialogs won't
                  >>resize even though I tried to handle the WM_SIZE message in the TabCtrl
                  >>class and MoveWindow to position the dialogs correctly on the tabctrl.
                  >
                  >
                  > This should work all right, but you do need to chain messages to CDialogResize by adding a CHAIN_MSG_MAP entry to each dialog's message map. You will also need to call DlgResize_Init during each dialog's WM_INITDIALOG handler, and I recommend specifying false for the bAddGripper parameter. You can lose the resizing border too.
                  >

                  Thanks Jim!

                  It works:) Like you suspected, I forgot to chain the messagemap to
                  DialogResize. But it really flickers a lot, I'm not really sure how to
                  handle the WM_SIZE message, this is what I do:

                  LRESULT CTabView::OnSize(UINT uMsg, WPARAM wParam,LPARAM lParam, BOOL&
                  bHandled)
                  {
                  LRESULT lRet = DefWindowProc(uMsg, wParam, lParam);
                  if(GetCurSel() == 1)
                  {
                  int cx=LOWORD(lParam);
                  int cy=HIWORD(lParam);


                  RECT rcAdjust={0};
                  AdjustRect(false,&rcAdjust);

                  m_plrSecondDialog.MoveWindow(rcAdjust.left,rcAdjust.top,cx,cy,0);
                  }

                  bHandled=false;
                  return lRet;
                  }
                • Mateusz Łoskot
                  ... May be you should call SetRedraw to eliminate or limit flickering: YourList.SetRedraw(FALSE); ... // operate on your list YourList.SetRedraw(TRUE); Greets
                  Message 8 of 10 , Aug 1, 2004
                  • 0 Attachment
                    On 8/2/2004 1:11 AM, Fredrik Axelsson wrote:
                    > It works:) Like you suspected, I forgot to chain the messagemap to
                    > DialogResize. But it really flickers a lot, I'm not really sure how to
                    > handle the WM_SIZE message, this is what I do:

                    May be you should call SetRedraw to eliminate or limit flickering:

                    YourList.SetRedraw(FALSE);
                    ... // operate on your list
                    YourList.SetRedraw(TRUE);

                    Greets

                    --

                    Mateusz Łoskot
                    mateusz at loskot dot net
                  • Jim Barry
                    ... Your WM_SIZE handler looks fine. By default, DlgResize_Init adds the WS_CLIPCHILDREN style to reduce flickering; this works with all the standard controls,
                    Message 9 of 10 , Aug 1, 2004
                    • 0 Attachment
                      Fredrik Axelsson wrote:
                      > It works:) Like you suspected, I forgot to chain the messagemap to
                      > DialogResize. But it really flickers a lot, I'm not really sure how to
                      > handle the WM_SIZE message, this is what I do:

                      Your WM_SIZE handler looks fine. By default, DlgResize_Init adds the WS_CLIPCHILDREN style to reduce flickering; this works with all the standard controls, except for group controls. If you are still getting a lot of flickering then I guess it is simply down to the controls you are using in your dialogs.

                      --
                      Jim Barry, MVP for Windows SDK
                    • Fredrik Axelsson
                      ... Thanks for all your help:) The Dialogs resize and doesn t flicker as much as they did before. When the controls are set to Transparent they look a lot
                      Message 10 of 10 , Aug 2, 2004
                      • 0 Attachment
                        Jim Barry wrote:
                        > Fredrik Axelsson wrote:
                        >
                        >>It works:) Like you suspected, I forgot to chain the messagemap to
                        >>DialogResize. But it really flickers a lot, I'm not really sure how to
                        >>handle the WM_SIZE message, this is what I do:
                        >
                        >
                        > Your WM_SIZE handler looks fine. By default, DlgResize_Init adds the WS_CLIPCHILDREN style to reduce flickering; this works with all the standard controls, except for group controls. If you are still getting a lot of flickering then I guess it is simply down to the controls you are using in your dialogs.
                        >

                        Thanks for all your help:) The Dialogs resize and doesn't flicker as
                        much as they did before. When the controls are set to Transparent they
                        look a lot better too.
                      Your message has been successfully submitted and would be delivered to recipients shortly.