Click here to Skip to main content
16,004,727 members
Home / Discussions / Managed C++/CLI
   

Managed C++/CLI

 
GeneralRe: how can i get input from hardware(Non computer Devices ) Devices ? Pin
George L. Jackson10-Dec-07 5:11
George L. Jackson10-Dec-07 5:11 
Questioncan anybody tell me why the size of an empty class is 1 Pin
philiptabraham9-Dec-07 23:19
philiptabraham9-Dec-07 23:19 
AnswerRe: can anybody tell me why the size of an empty class is 1 [modified] Pin
George L. Jackson10-Dec-07 3:31
George L. Jackson10-Dec-07 3:31 
AnswerRe: can anybody tell me why the size of an empty class is 1 Pin
Luc Pattyn10-Dec-07 3:41
sitebuilderLuc Pattyn10-Dec-07 3:41 
AnswerRe: can anybody tell me why the size of an empty class is 1 [modified] Pin
Mark Salsbery10-Dec-07 7:59
Mark Salsbery10-Dec-07 7:59 
GeneralRe: can anybody tell me why the size of an empty class is 1 Pin
George L. Jackson10-Dec-07 8:36
George L. Jackson10-Dec-07 8:36 
GeneralRe: can anybody tell me why the size of an empty class is 1 Pin
Mark Salsbery10-Dec-07 9:17
Mark Salsbery10-Dec-07 9:17 
QuestionMVC Design Pattern - Controller & View problem Pin
atzplzw9-Dec-07 13:55
atzplzw9-Dec-07 13:55 
Hello!

Being new to C++/CLI I'm trying to create a MVC design pattern as a start. Sadly I'm stuck with event management. Here is my code so far:

Controller.h
<br />
#pragma once <br />
#include "Model.h" <br />
#include "View.h" <br />
<br />
public ref class Controller <br />
{ <br />
private: Model^ mainModel; <br />
private: View^ mainView; <br />
<br />
public: Controller(void) { <br />
    mainModel = gcnew Model(); <br />
    mainView = gcnew View(this); <br />
    Application::Run(mainView); <br />
  } <br />
public: System::Void Btn_Open_Click(System::Object^ sender, System::EventArgs^ e) {<br />
    //do something<br />
  }<br />
};<br />


View.h
<br />
#pragma once <br />
//class forward declaration<br />
ref class Controller; <br />
<br />
public ref class View : public System::Windows::Forms::Form <br />
{ <br />
private: Controller^ mainController; <br />
public: View(Controller^ con) { <br />
    mainController = con; <br />
    InitializeComponent(); <br />
  } <br />
InitializeComponent() { <br />
... <br />
this->Btn_Open->Click += gcnew System::EventHandler(this, &mainController::Btn_Open_Click);<br />
...<br />
} <br />


With MCV the controller is responsible for event managment. That's why I choose to create the View with a reference to the controller.
But now I'm stuck with the EventHandler. The code above compiles fine when the last line is commented out. Of course, then there is no event handler.

So what is the correct way to do this? I just want the EventHandler in the View class to call a method in another class. How to do that?

Thanks for your help and suggestions!
GeneralRe: MVC Design Pattern - Controller & View problem Pin
George L. Jackson10-Dec-07 14:03
George L. Jackson10-Dec-07 14:03 
GeneralRe: MVC Design Pattern - Controller & View problem Pin
led mike11-Dec-07 6:56
led mike11-Dec-07 6:56 
General[Message Deleted] Pin
rogery9-Dec-07 0:28
rogery9-Dec-07 0:28 
GeneralRe: control type Pin
Luc Pattyn9-Dec-07 7:13
sitebuilderLuc Pattyn9-Dec-07 7:13 
GeneralRe: control type Pin
George L. Jackson9-Dec-07 11:25
George L. Jackson9-Dec-07 11:25 
GeneralRe: control type Pin
Luc Pattyn9-Dec-07 12:13
sitebuilderLuc Pattyn9-Dec-07 12:13 
AnswerRe: control type Pin
George L. Jackson9-Dec-07 11:33
George L. Jackson9-Dec-07 11:33 
GeneralSubclassing a window and not getting all the messages Pin
Dave Calkins7-Dec-07 17:32
Dave Calkins7-Dec-07 17:32 
GeneralManage Visual C++.NET to C#.NET Pin
jimmy2shoes7-Dec-07 13:39
jimmy2shoes7-Dec-07 13:39 
GeneralRe: Manage Visual C++.NET to C#.NET Pin
Dave Doknjas7-Dec-07 14:23
Dave Doknjas7-Dec-07 14:23 
GeneralRe: Manage Visual C++.NET to C#.NET Pin
jimmy2shoes8-Dec-07 0:41
jimmy2shoes8-Dec-07 0:41 
GeneralRe: Manage Visual C++.NET to C#.NET Pin
Dave Doknjas8-Dec-07 2:53
Dave Doknjas8-Dec-07 2:53 
GeneralRe: Manage Visual C++.NET to C#.NET Pin
jimmy2shoes9-Dec-07 5:26
jimmy2shoes9-Dec-07 5:26 
GeneralRe: Manage Visual C++.NET to C#.NET Pin
Dave Doknjas9-Dec-07 17:11
Dave Doknjas9-Dec-07 17:11 
GeneralRe: Manage Visual C++.NET to C#.NET Pin
Luc Pattyn8-Dec-07 1:32
sitebuilderLuc Pattyn8-Dec-07 1:32 
GeneralRe: Manage Visual C++.NET to C#.NET Pin
jimmy2shoes10-Dec-07 0:02
jimmy2shoes10-Dec-07 0:02 
GeneralRe: Manage Visual C++.NET to C#.NET Pin
Luc Pattyn10-Dec-07 8:51
sitebuilderLuc Pattyn10-Dec-07 8:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.