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. FormView override doubt

FormView override doubt

Scheduled Pinned Locked Moved C / C++ / MFC
databasequestion
7 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.
  • R Offline
    R Offline
    RuiSantiago
    wrote on last edited by
    #1

    Hello! I'm overriding OnActivateView function in my CFormView derived class, and it is in that function that i'm creating and displaying some objects, the number of objects depends on a database query. In order to resize my form, i must have its CRect parameters. Inside OnActivateView i do : GetClientRect(&myRect);, but all the size parameters (left, top, right, bottom) are equal to 0. Maybe i'm wrong but i understand that these values should only be available when OnActivateView is finished. My question: Is there an onverride for CFormView that is called after OnActivateView and where CRect parameters are available? Thank you in advance

    J 1 Reply Last reply
    0
    • R RuiSantiago

      Hello! I'm overriding OnActivateView function in my CFormView derived class, and it is in that function that i'm creating and displaying some objects, the number of objects depends on a database query. In order to resize my form, i must have its CRect parameters. Inside OnActivateView i do : GetClientRect(&myRect);, but all the size parameters (left, top, right, bottom) are equal to 0. Maybe i'm wrong but i understand that these values should only be available when OnActivateView is finished. My question: Is there an onverride for CFormView that is called after OnActivateView and where CRect parameters are available? Thank you in advance

      J Offline
      J Offline
      jmkhael
      wrote on last edited by
      #2

      Why dont u do all this work in OnDraw?? Papa while (TRUE) Papa.WillLove ( Bebe ) ;

      R 1 Reply Last reply
      0
      • J jmkhael

        Why dont u do all this work in OnDraw?? Papa while (TRUE) Papa.WillLove ( Bebe ) ;

        R Offline
        R Offline
        RuiSantiago
        wrote on last edited by
        #3

        Well, i'm a beginner and, I want to execute the following piece of code just after OnActivateView. I am not sure about OnDraw(). I tried placing the code in OnDraw() but I got a flickering screen. CRect myRect; CSize mySize; GetClientRect(&myRect); if (myRect.bottom<=y) //y is the vertical position of my last object { myRect.bottom+=200; MoveWindow(&myRect, TRUE); mySize=myRect.Size(); SetScrollSizes(MM_TEXT, mySize); GetParentFrame()->RecalcLayout(); } What am I doing wrong? Thanks for your trouble.

        J 1 Reply Last reply
        0
        • R RuiSantiago

          Well, i'm a beginner and, I want to execute the following piece of code just after OnActivateView. I am not sure about OnDraw(). I tried placing the code in OnDraw() but I got a flickering screen. CRect myRect; CSize mySize; GetClientRect(&myRect); if (myRect.bottom<=y) //y is the vertical position of my last object { myRect.bottom+=200; MoveWindow(&myRect, TRUE); mySize=myRect.Size(); SetScrollSizes(MM_TEXT, mySize); GetParentFrame()->RecalcLayout(); } What am I doing wrong? Thanks for your trouble.

          J Offline
          J Offline
          jmkhael
          wrote on last edited by
          #4

          u are flickering i guess cos MoveWindow( LPCRECT lpRect, BOOL bRepaint = TRUE ); This means that ur sending a WM_PAINT message froom within the OnDraw, try changing it to FALSE Papa while (TRUE) Papa.WillLove ( Bebe ) ;

          R 1 Reply Last reply
          0
          • J jmkhael

            u are flickering i guess cos MoveWindow( LPCRECT lpRect, BOOL bRepaint = TRUE ); This means that ur sending a WM_PAINT message froom within the OnDraw, try changing it to FALSE Papa while (TRUE) Papa.WillLove ( Bebe ) ;

            R Offline
            R Offline
            RuiSantiago
            wrote on last edited by
            #5

            I tried that, with and without GetParentFrame()->RecalcLayout(); And in none of those ways i got satisfactory results. I'm doing like : void CStocks::OnDraw(CDC* /*pDC*/) { CRect myRect; CSize mySize; GetClientRect(&myRect); if (myRect.bottom<=m_iLastY) { myRect.bottom+=500; MoveWindow(&myRect, FALSE); mySize=myRect.Size(); SetScrollSizes(MM_TEXT, mySize); //GetParentFrame()->RecalcLayout(); } } After OnActivateView is finished, i have the final value for m_iLastY, and then iwant to use it to resize, is there an alternative to OnDraw? Am i doing something wrong? Thank again

            J 1 Reply Last reply
            0
            • R RuiSantiago

              I tried that, with and without GetParentFrame()->RecalcLayout(); And in none of those ways i got satisfactory results. I'm doing like : void CStocks::OnDraw(CDC* /*pDC*/) { CRect myRect; CSize mySize; GetClientRect(&myRect); if (myRect.bottom<=m_iLastY) { myRect.bottom+=500; MoveWindow(&myRect, FALSE); mySize=myRect.Size(); SetScrollSizes(MM_TEXT, mySize); //GetParentFrame()->RecalcLayout(); } } After OnActivateView is finished, i have the final value for m_iLastY, and then iwant to use it to resize, is there an alternative to OnDraw? Am i doing something wrong? Thank again

              J Offline
              J Offline
              jmkhael
              wrote on last edited by
              #6

              Check void ResizeParentToFit( BOOL bShrinkOnly = TRUE ); guess it could help u Papa while (TRUE) Papa.WillLove ( Bebe ) ;

              R 1 Reply Last reply
              0
              • J jmkhael

                Check void ResizeParentToFit( BOOL bShrinkOnly = TRUE ); guess it could help u Papa while (TRUE) Papa.WillLove ( Bebe ) ;

                R Offline
                R Offline
                RuiSantiago
                wrote on last edited by
                #7

                Thanks again Papa! But i don't think i must use OnDraw, i just want to find a way of calling some code after OnActivateView is finished. Is that possivel?...I even thougth on using timers... Thanks

                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