reference problem, plz help
-
Hi, I have a reference problem that I would like some help with. Say I have a windows form with a treeview on it. From this form I create a controller and passing a reference to the form; controller = new Controller(this); This controller class handles user events and builds the treeview with a couple of nodes on the windows form by calling a method in the form, so far so good. But say I want to have another controller that can add one node to the treeview. How do I best reference the winform method that is responsible for adding one node to its treeview? /hope I make any sense
-
Hi, I have a reference problem that I would like some help with. Say I have a windows form with a treeview on it. From this form I create a controller and passing a reference to the form; controller = new Controller(this); This controller class handles user events and builds the treeview with a couple of nodes on the windows form by calling a method in the form, so far so good. But say I want to have another controller that can add one node to the treeview. How do I best reference the winform method that is responsible for adding one node to its treeview? /hope I make any sense
Sounds like you're building an OO nightmare. Why would you need all these controllers ? The way I'd do it is to add delegates that hook the controller to the UI, so the controller can call methods which change the state of the app, the presentation layer ( the form ) should be responsible for how that data is displayed, for example, in a tree view. Actually, I was assuming you're using MVC, but you can't be, the controller is all about accepting input, which has nothing to do with how the view is rendered at all. What do you mean by controller ?
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
-
Sounds like you're building an OO nightmare. Why would you need all these controllers ? The way I'd do it is to add delegates that hook the controller to the UI, so the controller can call methods which change the state of the app, the presentation layer ( the form ) should be responsible for how that data is displayed, for example, in a tree view. Actually, I was assuming you're using MVC, but you can't be, the controller is all about accepting input, which has nothing to do with how the view is rendered at all. What do you mean by controller ?
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
Well im using delegates to hook up the controller to the UI, this all works fine for me in a simple scenario (one view, one controller). But now im trying to do a more realistic scenario with a couple of forms (mdiparent/childs). As I understand it you typically have one controller for each set of related functionality. Then one controller should be able to handle user input and call methods on different forms?