Forms - Menu Tree Problems

G

Guest

I've been trying to build a neat menu tree system from forms in the CF that
is not hard coded into multiple forms, but i've had a great deal of
difficulty. The requirements of my menu system is that, it is build at
compile time, the forms are built prior to the application being run, and the
whole tree is flexible enough to change easily. So i am using a MenuForm,
with an AddButton method, which takes a MenuForm or a Form, and a string, and
creates a button that launches the form when it is clicked.

All forms are built when the program starts, and constructed into a menu
tree, which can then be navigated. I have a number of issues with this:

1)When i create a form it is displayed instantly, I have to manualy close
each form after it has been created. Which makes my application look like
it's having a fit.

2)As my tree is pre-built, i cannot use Close(), instead, I have to
implement a Hide event, and wire the parent into that so that it can call
this.Show().

3) When Show() is called, all my forms are displayed minimised, even if I
immediately set the windowstate to maximised.


Basicaly, I don't want to hard code my menu tree. And this solution, while
perfectly valid in conventional .Net is giving me no end of headaches in the
CF framework. (I've only been using the CF framework for about a week and a
half, and i'm hitting all kinds of hiccups).

Can anyone help with this issue?

Cheers

Tris

Tris
 
D

Daniel Moth

Can you shows us a reproducible sample so we can offer advice based on it.

Cheers
Daniel
 
G

Guest

It's OK Daniel,

I implemented a similar solution using Show() and Hide() on a panel tree
rather than Forms. It's much easier, Neater and Cleaner, and still gives me
all the functionality I needed in 1 form.

but if you are interested, the Click event of the button fired:

Clicked(object sender, EventArgs e)
{
Form f = FormLookup(sender);
this.Hide();
f.Show()
f.Hide += new EventHandler(ChildHidden)
}

ChildHidden(object sender, EventArgs e)
{
//This and other permutations
this.show();
this.WindowState = Maximised;
this.BringToFront();
}

The Hide event was fired in the child form when the Back button in the child
form was clicked.

Cheers

Tris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top