CListCtrl issue
-
I have a MFC application that has a lot of list view in report mode. I have implemented a CGenericListCtrl (derived from CListCtrl) that contains common functionality used in all those list views. All the list views used in my applicatons are derived from CGenericListCtrl. What I am trying to do is basically impement the sorting functionality based upon the type of the columns. For example some columns could be numeric whereas other could be string or date type. In the CGenericListCtrl I have implemnted a Compare function that apply the sorting algorithm depending upon type of the column. So Let's say I have a class CMYFirstListCtrl that is derived from CGenericListCtrl. In CMYFirstListCtrl at the time of creation of columns I also have an array that contains the type of data stored in each column ( via some enumns). What I am trying to do is that when user click on CMYFirstListCtrl header for sorting, I need to pass the column type enum to Compare method of CGenericListCtrl. Can anyone please help me how can I pass this info from a derived class to its parent though some sort of notification?
-
I have a MFC application that has a lot of list view in report mode. I have implemented a CGenericListCtrl (derived from CListCtrl) that contains common functionality used in all those list views. All the list views used in my applicatons are derived from CGenericListCtrl. What I am trying to do is basically impement the sorting functionality based upon the type of the columns. For example some columns could be numeric whereas other could be string or date type. In the CGenericListCtrl I have implemnted a Compare function that apply the sorting algorithm depending upon type of the column. So Let's say I have a class CMYFirstListCtrl that is derived from CGenericListCtrl. In CMYFirstListCtrl at the time of creation of columns I also have an array that contains the type of data stored in each column ( via some enumns). What I am trying to do is that when user click on CMYFirstListCtrl header for sorting, I need to pass the column type enum to Compare method of CGenericListCtrl. Can anyone please help me how can I pass this info from a derived class to its parent though some sort of notification?
Hi I am not sure if I have understood your problem!!! What I think is that you can implement the funtionality for parent class instead of derive class, so that the parent class funtion can directly be called. this may not help you lot... other method you may use "super" to get parent class methods and variable.
-
Hi I am not sure if I have understood your problem!!! What I think is that you can implement the funtionality for parent class instead of derive class, so that the parent class funtion can directly be called. this may not help you lot... other method you may use "super" to get parent class methods and variable.
There is no keyword super in C++. It's available only in Java. I am not seeing any problem whatsoever using the Sort function of the Base class. Just call the method Sort(...) and pass the parameters. As long as the Sort method is not virtual, you will always end-up in the Base class method. Alternatively you can think of making Sort(...) method static as long as it is not refering any class memebers and you are passing all the values in the parameter list. You can invoke the method using CGenericListCtrl::Sort(...) "A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
-
There is no keyword super in C++. It's available only in Java. I am not seeing any problem whatsoever using the Sort function of the Base class. Just call the method Sort(...) and pass the parameters. As long as the Sort method is not virtual, you will always end-up in the Base class method. Alternatively you can think of making Sort(...) method static as long as it is not refering any class memebers and you are passing all the values in the parameter list. You can invoke the method using CGenericListCtrl::Sort(...) "A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
Thanks for the response guys. Problem is that OnColumnClick is invoked from the dervied class and during that event I am not sure how can I pass this additional variable containing type of the header. Is there any lParam type of thing that I use to fill in this info? Thanks