Click here to Skip to main content
15,903,362 members
Home / Discussions / C#
   

C#

 
GeneralRe: Loading a form in another form like win explorer Pin
leppie11-Mar-03 8:37
leppie11-Mar-03 8:37 
GeneralRe: Loading a form in another form like win explorer Pin
Arun Bhalla17-Mar-03 17:04
Arun Bhalla17-Mar-03 17:04 
GeneralRe: Loading a form in another form like win explorer Pin
James T. Johnson17-Mar-03 18:00
James T. Johnson17-Mar-03 18:00 
GeneralRe: Loading a form in another form like win explorer Pin
Arun Bhalla17-Mar-03 18:16
Arun Bhalla17-Mar-03 18:16 
GeneralRe: Loading a form in another form like win explorer Pin
foxms13-Apr-03 4:29
foxms13-Apr-03 4:29 
GeneralRe: Loading a form in another form like win explorer Pin
LongRange.Shooter11-Mar-03 8:55
LongRange.Shooter11-Mar-03 8:55 
GeneralRe: Loading a form in another form like win explorer Pin
John'o12-Mar-03 12:09
John'o12-Mar-03 12:09 
GeneralRe: Loading a form in another form like win explorer Pin
LongRange.Shooter13-Mar-03 4:36
LongRange.Shooter13-Mar-03 4:36 
Situation:
I had an MDI parent. I added another form which is my 'launcher' and that is docked in the Magic Docking Control. In my parent -- at form load time -- it was a simple matter of a few simple steps:
Instantiate an instance of the dockManger
Instantiate an instance of the launcher (I pass the handle of
the parent to the launcher in the Constructor logic)
Add the launcher instance to the dockManager
Voila -- it works just grand and is very simple to implement
<br />
manager  = new DockingManager(this, VisualStyle.IDE);<br />
Content ef = manager.Contents.Add(new editorForm<br />
     (this, userChoices, desiredWeb), "Navigation Flows");<br />
ef.DisplaySize = new Size(192,464);<br />
ef.FloatingSize = new Size(192, 464);<br />
ef.AutoHideSize = new Size(192, 464);<br />
this.menuItem1.Enabled = true;<br />
manager.AddContentWithState(ef, State.DockLeft);<br />

Setting the sizes shown above is pixel tweaking to have the window open up as far as I wanted it to be displayed. (width is main value the manager is concerened with)

Next issue:
Each child constructs a navigation view. I was asked to change colors whenever one page in the view is replicated across children. This meant I had to wait until the child was fully implemented to handle the color change.

<br />
editView newView = new editView<br />
  (StartingPageName, tcaAccessor, holdWebCollection, holdWebname);<br />
newView.MdiParent = thisParent;<br />
newView.Text = selectedObject.Text;<br />
//marshal parent object to main form then delegate event handler<br />
main ParentForm = thisParent as main;<br />
newView.CompletedLoadEvent += new editView.CompletedLoadEventHandler(ParentForm.mdiParent_childLoadComplete);<br />
newView.Show();<br />

I pass the objects the child needs. I establish MDIParent to my parent form in the new child, and I establish the evenhandler in my parent form as well. Then I launch the child with the Show();

So in my base child form, I define the event:
<br />
public delegate void CompletedLoadEventHandler<br />
   (object sender, string childName);<br />
public event CompletedLoadEventHandler CompletedLoadEvent;<br />

Then at the end of the load process I raise the event:
<br />
if (CompletedLoadEvent != null)<br />
    CompletedLoadEvent(this, this.Text);<br />


You could code a number of custom events to comunicate back to the parent. I found that I had to do a custom event to guarantee that some accidental firing of an already-existing event did no occur.

If you happen to have the launcher as a menu item within the parent it is even easier since you do not have to hold reference to your parent inside the launcher. In setting up the launcher inside the manager --- creating the new launcher and passing (this) as a parameter which my launcher saves as a variable thisParent inside itself makes the launcher properly define the parent in each child.

_____________________________________________
The world is a dangerous place.
Not because of those that do evil,
    but because of those who look on and do nothing.

GeneralRe: Loading a form in another form like win explorer Pin
John'o24-Mar-03 20:11
John'o24-Mar-03 20:11 
GeneralRe: Loading a form in another form like win explorer Pin
LongRange.Shooter28-Mar-03 2:49
LongRange.Shooter28-Mar-03 2:49 
Generalpopulating an input of file type textbox Pin
CucumberPickles10-Mar-03 12:24
CucumberPickles10-Mar-03 12:24 
GeneralRe: populating an input of file type textbox Pin
James T. Johnson10-Mar-03 17:59
James T. Johnson10-Mar-03 17:59 
GeneralA simple Form OK button question Pin
DionChen10-Mar-03 11:36
DionChen10-Mar-03 11:36 
GeneralRe: A simple Form OK button question Pin
Gogou10-Mar-03 12:02
Gogou10-Mar-03 12:02 
GeneralRe: A simple Form OK button question Pin
DionChen10-Mar-03 16:48
DionChen10-Mar-03 16:48 
GeneralRe: A simple Form OK button question Pin
James T. Johnson10-Mar-03 18:07
James T. Johnson10-Mar-03 18:07 
GeneralRe: A simple Form OK button question Pin
Zek3vil11-Mar-03 7:01
Zek3vil11-Mar-03 7:01 
GeneralRe: A simple Form OK button question Pin
LongRange.Shooter11-Mar-03 7:33
LongRange.Shooter11-Mar-03 7:33 
QuestionBackground color on a TreeView checkbox? Pin
se99ts10-Mar-03 10:35
se99ts10-Mar-03 10:35 
QuestionDataSet bind to datagrid, how to flush or reject changes on Form.Closing ? Pin
Chris Richner10-Mar-03 10:25
Chris Richner10-Mar-03 10:25 
AnswerRe: DataSet bind to datagrid, how to flush or reject changes on Form.Closing ? Pin
leppie10-Mar-03 10:39
leppie10-Mar-03 10:39 
GeneralRe: DataSet bind to datagrid, how to flush or reject changes on Form.Closing ? Pin
Chris Richner10-Mar-03 22:48
Chris Richner10-Mar-03 22:48 
GeneralRe: DataSet bind to datagrid, how to flush or reject changes on Form.Closing ? Pin
ed2d11-Mar-03 21:25
ed2d11-Mar-03 21:25 
GeneralRe: DataSet bind to datagrid, how to flush or reject changes on Form.Closing ? Pin
Chris Richner12-Mar-03 5:08
Chris Richner12-Mar-03 5:08 
QuestionGet xpath of current Node? Pin
Bog10-Mar-03 10:00
Bog10-Mar-03 10:00 

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.