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. MDI VC++, How to pass parameters to view?

MDI VC++, How to pass parameters to view?

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestionc++tutorial
4 Posts 3 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.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    So, view may appear differently? I want to pass some parameter to view, these parameter is created at run time. So how can I pass them to view? A way to work arround is save those parameter in Doc. But it looks not quite right. I hope I can create CView::CView( int A, int B ) there is CView::Cview() already. so when template create view, pass A and B to view, so CView::CView( int A, int B ) is called, instaed of CView::CView( ). I was stuck, Please help me out. Thank you inadvance. :confused:

    J 1 Reply Last reply
    0
    • L Lost User

      So, view may appear differently? I want to pass some parameter to view, these parameter is created at run time. So how can I pass them to view? A way to work arround is save those parameter in Doc. But it looks not quite right. I hope I can create CView::CView( int A, int B ) there is CView::Cview() already. so when template create view, pass A and B to view, so CView::CView( int A, int B ) is called, instaed of CView::CView( ). I was stuck, Please help me out. Thank you inadvance. :confused:

      J Offline
      J Offline
      John R Shaw
      wrote on last edited by
      #2

      Storing it in the document does make since. You can pass additional information to the veiw of a particular document via OnUpdateAll(...,lHint,pHint). The lHint, argument can be long value (or a pointer value stored in a long). The pHint can be used if the addition information is stored in a CObject derive object. Good Luck! INTP "The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes." Andrew W. Troelsen

      D 1 Reply Last reply
      0
      • J John R Shaw

        Storing it in the document does make since. You can pass additional information to the veiw of a particular document via OnUpdateAll(...,lHint,pHint). The lHint, argument can be long value (or a pointer value stored in a long). The pHint can be used if the addition information is stored in a CObject derive object. Good Luck! INTP "The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes." Andrew W. Troelsen

        D Offline
        D Offline
        david_gilmour
        wrote on last edited by
        #3

        It would be easier to store it in document. In your view's OnDraw just call GetDocument() to get the document and then the parameter and simply write your drawing code depending on the parameter

        J 1 Reply Last reply
        0
        • D david_gilmour

          It would be easier to store it in document. In your view's OnDraw just call GetDocument() to get the document and then the parameter and simply write your drawing code depending on the parameter

          J Offline
          J Offline
          John R Shaw
          wrote on last edited by
          #4

          wwwrabbit1 already knows how to do that but wanted another way (to pass information to CView object) to accomplish the same thing and that is what the hint parameters are for. I personaly would contenue to store the information in the document, where it (probably) belongs. What we do not know is what effect the information is supposed to have, other than they effect what is to be shown. INTP "The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes." Andrew W. Troelsen

          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