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. send args to constructor when using RUNTIME_CLASS

send args to constructor when using RUNTIME_CLASS

Scheduled Pinned Locked Moved C / C++ / MFC
databasecomtoolsquestion
2 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.
  • B Offline
    B Offline
    BlackDice
    wrote on last edited by
    #1

    I have a few nested splitters on my main screen and two of the panes use forms that are exactly the same in look and functionality except for a couple of strings. If there was a way I could send in some value to determine which stored procedure it should use to fill the list control, everything would be great and I could use an instance of the same class for both panes. But I create the formviews using RUNTIME_CLASS when creating the splitters. While writing this post I've just thought about I could make the class I want to use a parent class, make two derived classes, each one calling the parent's constructor with the string or enum values I want. Something like this: class CLeftFormView : public CMyFormView { //call my CFormView constructor with string "leftpane" }; class CRightFormView : public CMyFormView { //call my CFormView constructor with string "rightpane" }; This seems like it would work, but I wonder is there a better method for what I'm trying to do. Any suggestions are appreciated. Thanks

    My Music | My Pics | My Articles BlackDice

    C 1 Reply Last reply
    0
    • B BlackDice

      I have a few nested splitters on my main screen and two of the panes use forms that are exactly the same in look and functionality except for a couple of strings. If there was a way I could send in some value to determine which stored procedure it should use to fill the list control, everything would be great and I could use an instance of the same class for both panes. But I create the formviews using RUNTIME_CLASS when creating the splitters. While writing this post I've just thought about I could make the class I want to use a parent class, make two derived classes, each one calling the parent's constructor with the string or enum values I want. Something like this: class CLeftFormView : public CMyFormView { //call my CFormView constructor with string "leftpane" }; class CRightFormView : public CMyFormView { //call my CFormView constructor with string "rightpane" }; This seems like it would work, but I wonder is there a better method for what I'm trying to do. Any suggestions are appreciated. Thanks

      My Music | My Pics | My Articles BlackDice

      C Offline
      C Offline
      Christopher Duncan
      wrote on last edited by
      #2

      Actually, that seems like a pretty reasonable approach to me. I'd definitely give it a go.

      Author of The Career Programmer and Unite the Tribes www.PracticalStrategyConsulting.com

      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