Hi all,
maybe my design is not good, or I don't see the obvious solution, but I want to subscribe to a buttonClick EventHandler of Form1 from outside form1.
For example I have a Controller and Form1 who are both instanced in the main function. Now I want to subscribe a function from Controller to the buttonClick event from Button1_Click in Form1. But the button1 is declarded private, so i can't do
form1->Button1->Click += gcnew EventHandler(controller->function)
Is there any way to get around this?
Ok I could write a setter or something in Form1, but is there any other solution?
I read some examples, but they are all calling events from within the same class so they don't address my specific problem.
EDIT
Maybe it helps if I say what I really want to achieve:
Ok there is the GUI aka Form1 and a Conroller Class.
The Controller should get notified, if the user triggers a specific ButtonClick event on the GUI. Also the Controller should be able to subscribe and unsubscripe from different events during runtime. To make it even more confusing (atleast for me) the controller should raise events, which trigger some GUI behaviors, like enabling some buttons and disabling others. So this is what I want to do, at least in theory it sounded good, but now I have problems with the implementation.