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. renew?

renew?

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestionlearning
3 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.
  • W Offline
    W Offline
    Wim Engberts
    wrote on last edited by
    #1

    Hi I am writing an application where the user can enter multiple occurences of an edit control or a combo-box. I keep adding new Edit controls whenever the user fills the previous one. On order to allocate these edit controls, I use the "new" operator. However, when I need to add a new CEdit control, I would need something like a "renew" operator (much like the realloc routine). Does anyone know how to do this? I could of course allocate a completely new set of Edit controls, and then copy the properties of the already used ones, but this seems like a rather clumsy way of doing things! Thanks in advance. William

    M D 2 Replies Last reply
    0
    • W Wim Engberts

      Hi I am writing an application where the user can enter multiple occurences of an edit control or a combo-box. I keep adding new Edit controls whenever the user fills the previous one. On order to allocate these edit controls, I use the "new" operator. However, when I need to add a new CEdit control, I would need something like a "renew" operator (much like the realloc routine). Does anyone know how to do this? I could of course allocate a completely new set of Edit controls, and then copy the properties of the already used ones, but this seems like a rather clumsy way of doing things! Thanks in advance. William

      M Offline
      M Offline
      Maxwell Chen
      wrote on last edited by
      #2
      1. If you are talking about C++ syntax, there is the method called "placement new" for you to new the objects at the specified address (in this case, the address of previous newed objects). 2) After new, you should "create" the edit controls to create the windows ...

      Maxwell Chen

      1 Reply Last reply
      0
      • W Wim Engberts

        Hi I am writing an application where the user can enter multiple occurences of an edit control or a combo-box. I keep adding new Edit controls whenever the user fills the previous one. On order to allocate these edit controls, I use the "new" operator. However, when I need to add a new CEdit control, I would need something like a "renew" operator (much like the realloc routine). Does anyone know how to do this? I could of course allocate a completely new set of Edit controls, and then copy the properties of the already used ones, but this seems like a rather clumsy way of doing things! Thanks in advance. William

        D Offline
        D Offline
        David Crow
        wrote on last edited by
        #3

        Why don't you use one of MFC's or STL's containers? They will grow/shrink without having to worry about memory management.


        "Money talks. When my money starts to talk, I get a bill to shut it up." - Frank

        "Judge not by the eye but by the heart." - Native American Proverb

        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