send args to constructor when using RUNTIME_CLASS
-
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. ThanksMy Music | My Pics | My Articles 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. ThanksMy Music | My Pics | My Articles BlackDice
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