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#
  4. reference problem, plz help

reference problem, plz help

Scheduled Pinned Locked Moved C#
helpquestion
3 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.
  • A Offline
    A Offline
    akkram
    wrote on last edited by
    #1

    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

    C 1 Reply Last reply
    0
    • A akkram

      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

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      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 )

      A 1 Reply Last reply
      0
      • C Christian Graus

        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 )

        A Offline
        A Offline
        akkram
        wrote on last edited by
        #3

        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?

        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