Click here to Skip to main content
15,891,428 members
Home / Discussions / C#
   

C#

 
AnswerRe: Accessing other forms control? Pin
sreejith ss nair31-Aug-04 23:02
sreejith ss nair31-Aug-04 23:02 
GeneralRe: Accessing other forms control? Pin
sachinkalse31-Aug-04 23:46
sachinkalse31-Aug-04 23:46 
GeneralRe: Accessing other forms control? Pin
sreejith ss nair1-Sep-04 0:15
sreejith ss nair1-Sep-04 0:15 
GeneralRe: Accessing other forms control? Pin
sachinkalse1-Sep-04 1:01
sachinkalse1-Sep-04 1:01 
GeneralRe: Accessing other forms control? Pin
sreejith ss nair1-Sep-04 1:43
sreejith ss nair1-Sep-04 1:43 
AnswerRe: Accessing other forms control? Pin
LongRange.Shooter1-Sep-04 7:45
LongRange.Shooter1-Sep-04 7:45 
GeneralRe: Accessing other forms control? Pin
sachinkalse1-Sep-04 14:55
sachinkalse1-Sep-04 14:55 
GeneralRe: Accessing other forms control? Pin
LongRange.Shooter2-Sep-04 2:48
LongRange.Shooter2-Sep-04 2:48 
Okay -- here is an example of a bubble-up architecture:

I have a control which contains a treenode and a display area.
The 'display area' will have different custom controls loaded based on the type of data selected in the tree. This control can exist in the main form or can exist as a dialog by itself in your applications.

The parent form that contains this control has the job of opening the file. This event is exposed for anyone interested. It loads a custom control which can have access to the NewFileEvent from the parent form. This second custom control lets the user select filters from dropdown boxes. It raises the NewFilterEvent to its children and the NewFileEvent. So it has code like this:
parent.NewFileEvent += new NewFileHandler(NewFileBubbler);
...
private void NewFileHandler(object sender, NewFileArgs e)
{
  if (this.NewFileEvent != null)
    NewFileEvent(sender, e);
}

Each subsequent control that gets loaded may contain hundreds of controls but they pick and choose which events they are interested in. That initial control I spoke of wants to know when a new file is loaded and when a new filter is set. If you write a program that uses my control, you need to provide your own events using my defined event arguements to pass the new data, new file location, new filters, whatever.

The end result is the parent has no idea what is loaded in it. The control it loads loads other controls which load their controls, which load their controls. Events bubble up from the parent to the top-most control.

This handles a situation where you want all of the controls in the list to know that a state has changed. It sounds, though, like you want the reverse. You want to know when one of the controls changes. This sounds like you may want the Observer Pattern. It has an observer that acts as a go-between between the data (control state) and the observers (the items that have to react to that change).

Start here[^] to find out about the Observer Pattern and see if that helps your situation.

This signature left intentionally blank
GeneralRe: Accessing other forms control? Pin
sachinkalse2-Sep-04 14:56
sachinkalse2-Sep-04 14:56 
QuestionBlack-n-White Invert ? Pin
sachinkalse31-Aug-04 22:48
sachinkalse31-Aug-04 22:48 
AnswerRe: Black-n-White Invert ? Pin
Marc Clifton1-Sep-04 2:55
mvaMarc Clifton1-Sep-04 2:55 
GeneralRe: Black-n-White Invert ? Pin
sachinkalse2-Sep-04 19:51
sachinkalse2-Sep-04 19:51 
QuestionHow to hide a interface property in the sub-class? Pin
Jason Liu31-Aug-04 17:58
Jason Liu31-Aug-04 17:58 
AnswerRe: How to hide a interface property in the sub-class? Pin
Member 266231-Aug-04 22:33
Member 266231-Aug-04 22:33 
GeneralSyntaxError Pin
Jerry Hammond31-Aug-04 17:31
Jerry Hammond31-Aug-04 17:31 
GeneralRe: SyntaxError Pin
leppie1-Sep-04 0:39
leppie1-Sep-04 0:39 
GeneralRe: SyntaxError Pin
Jerry Hammond1-Sep-04 5:15
Jerry Hammond1-Sep-04 5:15 
GeneralRe: SyntaxError Pin
Marc Clifton1-Sep-04 2:54
mvaMarc Clifton1-Sep-04 2:54 
GeneralRe: SyntaxError Pin
Jerry Hammond1-Sep-04 5:16
Jerry Hammond1-Sep-04 5:16 
GeneralRe: SyntaxError Pin
Marc Clifton1-Sep-04 5:26
mvaMarc Clifton1-Sep-04 5:26 
QuestionHow to implement zoom in and out in windows forms panel ?? Pin
CNU31-Aug-04 16:58
CNU31-Aug-04 16:58 
AnswerRe: How to implement zoom in and out in windows forms panel ?? Pin
Marc Clifton1-Sep-04 2:49
mvaMarc Clifton1-Sep-04 2:49 
QuestionHow to make a library/dll in Visual C# Standard Edittion Pin
HalfAsleep31-Aug-04 12:02
HalfAsleep31-Aug-04 12:02 
AnswerRe: How to make a library/dll in Visual C# Standard Edittion Pin
Heath Stewart31-Aug-04 12:31
protectorHeath Stewart31-Aug-04 12:31 
GeneralRe: How to make a library/dll in Visual C# Standard Edittion Pin
HalfAsleep31-Aug-04 12:39
HalfAsleep31-Aug-04 12:39 

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.