Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Text with backspace in Transparent window

Text with backspace in Transparent window

Scheduled Pinned Locked Moved C / C++ / MFC
debugging
12 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Stuart Dootson

    It is working - it's just that with a NULL brush, the Invalidate call won't erase the characters you're backspacing over, as it paints over them with transparency. Try entering the following text in the window - abcd - you'll end up with abd after that, which shows that the backspace is being recognised.

    Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

    G Offline
    G Offline
    gcorrea
    wrote on last edited by
    #3

    Hi Mr. Dootson: Yes, I can see m_text contains "abc" after bakcspace but my transparent window shows "abcd". I need erase text or backspace draw in my transparent window. How can I do that? Do you have any idea?. Thanks

    S 1 Reply Last reply
    0
    • G gcorrea

      Hi Mr. Dootson: Yes, I can see m_text contains "abc" after bakcspace but my transparent window shows "abcd". I need erase text or backspace draw in my transparent window. How can I do that? Do you have any idea?. Thanks

      S Offline
      S Offline
      Stuart Dootson
      wrote on last edited by
      #4

      Weird - the window displayed "abd" when I did that - and I used the same code as you - well, the only difference is how I created the window. I put your window class registration code in the PreCreateWindow method of my view:

      BOOL CChildView::PreCreateWindow(CREATESTRUCT& cs)
      {
      if (!CWnd::PreCreateWindow(cs))
      return FALSE;

      cs.dwExStyle |= WS_EX_CLIENTEDGE;
      cs.style &= ~WS_BORDER;
      cs.lpszClass=AfxRegisterWndClass( NULL, NULL, (HBRUSH) NULL);

      return TRUE;
      }

      This method is called from within the CWnd::Create method, so should do much the same as your code?

      Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

      G 1 Reply Last reply
      0
      • S Stuart Dootson

        Weird - the window displayed "abd" when I did that - and I used the same code as you - well, the only difference is how I created the window. I put your window class registration code in the PreCreateWindow method of my view:

        BOOL CChildView::PreCreateWindow(CREATESTRUCT& cs)
        {
        if (!CWnd::PreCreateWindow(cs))
        return FALSE;

        cs.dwExStyle |= WS_EX_CLIENTEDGE;
        cs.style &= ~WS_BORDER;
        cs.lpszClass=AfxRegisterWndClass( NULL, NULL, (HBRUSH) NULL);

        return TRUE;
        }

        This method is called from within the CWnd::Create method, so should do much the same as your code?

        Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

        G Offline
        G Offline
        gcorrea
        wrote on last edited by
        #5

        Hi Mr.Dootson: I had added // Operations public: // Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CMyFrameWnd) virtual BOOL PreCreateWindow(CREATESTRUCT& cs); //}}AFX_VIRTUAL in my Class declarations and your PreCreateWindow code as BOOL CMyFrameWnd::PreCreateWindow(CREATESTRUCT& cs) { if (!CWnd::PreCreateWindow(cs)) return FALSE; cs.dwExStyle |= WS_EX_CLIENTEDGE; cs.style &= ~WS_BORDER; cs.lpszClass=AfxRegisterWndClass( NULL, NULL, (HBRUSH) NULL); return TRUE; } How I have to change Create? I used: Create(NULL, _T("Frame Window")) but it doesn't works. I get and ASSERT in wincore.cpp Line:722 and there is not any text in my window. What >I am doing wrong? Thanks

        S 1 Reply Last reply
        0
        • G gcorrea

          Hi Mr.Dootson: I had added // Operations public: // Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CMyFrameWnd) virtual BOOL PreCreateWindow(CREATESTRUCT& cs); //}}AFX_VIRTUAL in my Class declarations and your PreCreateWindow code as BOOL CMyFrameWnd::PreCreateWindow(CREATESTRUCT& cs) { if (!CWnd::PreCreateWindow(cs)) return FALSE; cs.dwExStyle |= WS_EX_CLIENTEDGE; cs.style &= ~WS_BORDER; cs.lpszClass=AfxRegisterWndClass( NULL, NULL, (HBRUSH) NULL); return TRUE; } How I have to change Create? I used: Create(NULL, _T("Frame Window")) but it doesn't works. I get and ASSERT in wincore.cpp Line:722 and there is not any text in my window. What >I am doing wrong? Thanks

          S Offline
          S Offline
          Stuart Dootson
          wrote on last edited by
          #6

          gcorrea wrote:

          How I have to change Create?

          I don't call Create at all - the view window's created by my CMainFrame class, which in turn is created within my application classes InitInstance method. So, slightly different class structure to yours. In your app's InitInstance method, changing

          m_pMainWnd = new CMyFrameWnd();

          to

          m_pMainWnd = new CMyFrameWnd();
          m_pMainWnd->Create();

          could probably work

          Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

          G 1 Reply Last reply
          0
          • S Stuart Dootson

            gcorrea wrote:

            How I have to change Create?

            I don't call Create at all - the view window's created by my CMainFrame class, which in turn is created within my application classes InitInstance method. So, slightly different class structure to yours. In your app's InitInstance method, changing

            m_pMainWnd = new CMyFrameWnd();

            to

            m_pMainWnd = new CMyFrameWnd();
            m_pMainWnd->Create();

            could probably work

            Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

            G Offline
            G Offline
            gcorrea
            wrote on last edited by
            #7

            When I do that I get error C2660: 'Create' : function does not take 0 parameters

            S 1 Reply Last reply
            0
            • G gcorrea

              When I do that I get error C2660: 'Create' : function does not take 0 parameters

              S Offline
              S Offline
              Stuart Dootson
              wrote on last edited by
              #8

              So add in the necessary parameters! My MainFrame class uses these parameters to create the view:

              m_wndView.Create(NULL, NULL, WS_CHILD | WS_VISIBLE | WS_BORDER, CRect(0, 0, 0, 0), this, 0xE900, NULL);

              Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

              G 1 Reply Last reply
              0
              • S Stuart Dootson

                So add in the necessary parameters! My MainFrame class uses these parameters to create the view:

                m_wndView.Create(NULL, NULL, WS_CHILD | WS_VISIBLE | WS_BORDER, CRect(0, 0, 0, 0), this, 0xE900, NULL);

                Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

                G Offline
                G Offline
                gcorrea
                wrote on last edited by
                #9

                Doing that I get: error C2664: 'Create' : cannot convert parameter 6 from 'const int' to 'const char *' This is referring to 0xE900. Do you think it is possible to send me your code to gcorrea@cguelectronics.com in order to evaluate? Thanks

                S 1 Reply Last reply
                0
                • G gcorrea

                  Doing that I get: error C2664: 'Create' : cannot convert parameter 6 from 'const int' to 'const char *' This is referring to 0xE900. Do you think it is possible to send me your code to gcorrea@cguelectronics.com in order to evaluate? Thanks

                  S Offline
                  S Offline
                  Stuart Dootson
                  wrote on last edited by
                  #10

                  Again the different class thing gets in the way. How about you read the documentation for your frame window vs. CWnd - that'll show you how the parameters fit in.

                  Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

                  G 1 Reply Last reply
                  0
                  • S Stuart Dootson

                    Again the different class thing gets in the way. How about you read the documentation for your frame window vs. CWnd - that'll show you how the parameters fit in.

                    Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

                    G Offline
                    G Offline
                    gcorrea
                    wrote on last edited by
                    #11

                    I had used differents parameters and ones don not compile, give me errors, others ones compile but give assertion failure but any works. Could you Mr. Dootson attach your working code zipped to compare what I am doing wrong?

                    G 1 Reply Last reply
                    0
                    • G gcorrea

                      I had used differents parameters and ones don not compile, give me errors, others ones compile but give assertion failure but any works. Could you Mr. Dootson attach your working code zipped to compare what I am doing wrong?

                      G Offline
                      G Offline
                      gcorrea
                      wrote on last edited by
                      #12

                      Thanks everybody. I had solved my problem ;)

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups