How to clone forms and navigate PREV-NEXT-OKAY-CANCEL

  • Thread starter Thread starter Patrick Coghlan
  • Start date Start date
P

Patrick Coghlan

I want to create about 4 forms with the same dimensions and background
colours, similar to the forms one has to traverse when installing
various software packages.

I'm using Visual Studio and C++ (changing to C# soon) and can create
separate forms, but I really just want to clone the first one, have the
user select different options on each form and navigate between them via
the PREV-NEXT-OKAY-CANCEL buttons on the bottom of the form.

What's the best technique for doing this?

Also, how do I create the separator line at the bottom of the screen
just above the PREV-NEXT-OKAY-CANCEL buttons?
 
Hi Patrick,

Patrick Coghlan said:
I want to create about 4 forms with the same dimensions and background
colours, similar to the forms one has to traverse when installing
various software packages.

I'm using Visual Studio and C++ (changing to C# soon) and can create
separate forms, but I really just want to clone the first one, have the
user select different options on each form and navigate between them via
the PREV-NEXT-OKAY-CANCEL buttons on the bottom of the form.

What's the best technique for doing this?

Also, how do I create the separator line at the bottom of the screen
just above the PREV-NEXT-OKAY-CANCEL buttons?

Are the four forms you are creating all part of one "wizard"? If yes, I
would suggest that you do not create four separate forms. Create one form
and four user controls. Flip between the user controls in response to the
user clicking the buttons on the form. Doing this will avoid the "flash"
that would otherwise occur when one form is closed and another is opened.
This will also be easier to manage, in my opinion.

As for the separator, in a similar circumstance I used a frame
(GroupBox), and sized/positioned it so that only the top line was visible.

Regards,
Daniel
 
I've just been following the C# core reference book, and am not familiar
with the Wizard.

I'd like to avoid the "flash" you referred to, and the 4 "displays"
(forms) have identical dimensions and background colour.

Conceptually, I see that it should be possible to toggle the visible
resource for a number of controls on the same screen so that it appears
that the user is moving from screen to screen. Are you suggesting that
there is a way to map different groupings of controls to the same form
and just switch the groupings in response to PREV/NEXT? How does one
edit/design the form without all the controls being superimposed on one
another?
 
Hi Patrick,

Patrick Coghlan said:
I've just been following the C# core reference book, and am not familiar
with the Wizard.

I'd like to avoid the "flash" you referred to, and the 4 "displays"
(forms) have identical dimensions and background colour.

Conceptually, I see that it should be possible to toggle the visible
resource for a number of controls on the same screen so that it appears
that the user is moving from screen to screen. Are you suggesting that
there is a way to map different groupings of controls to the same form
and just switch the groupings in response to PREV/NEXT? How does one
edit/design the form without all the controls being superimposed on one
another?

You have at least two options:

1. Place the controls for each "step" into a panel or some other control
container.
2. Create a user control for each step. Place the controls for a step
onto the user control and place the user controls onto the form.

Once you have done this, it is a simple matter of toggling the
visibility of the panels or user controls to display the controls for the
current step.

Regards,
Daniel
 
This certainly sounds like the way to go.

I assume you're aware that I'm using Visual Studio to design my form.

The containers are superimposed on one another, with only the desired
container visible. How does one drag & drop the containers on top of
each other in the form designer so that they are separate entities and
not just a big "stack"?

Perhaps there is something about the user control that I don't
understand. I'll check the C# manual, but in a nutshell, what is it?

Thanks for your help. This seems like a pretty common thing that
developers need to set up. A perfect example I just came across are the
Netscape screens for creating a free webmail account. It has all the
elements I'm looking for: horizontal separator, Back/Next/Cancel
buttons, different sets of controls on each screen. This is exactly
what I want to do with C# (vs Web app).
 
I talked to a VB programmer. He mentioned the following two methods:

1) Overlay the containers in the form designer.
2) Create a large form with <n> containers spread out, but at run time
change the form size so that it's just big enough to display one panel,
and then rotate the panels through the visible area of the form as
required (something about moving coordinates).

I'm not sure which method is more orthodox.
 
Hi Patrick,

Patrick Coghlan said:
I talked to a VB programmer. He mentioned the following two methods:

1) Overlay the containers in the form designer.
2) Create a large form with <n> containers spread out, but at run time
change the form size so that it's just big enough to display one panel,
and then rotate the panels through the visible area of the form as
required (something about moving coordinates).

I'm not sure which method is more orthodox.

Whatever suits you, I would say. A couple tips:

First, if you double-click on an item in the toolbox, the item will be
added as a child to whatever control container is currently selected or the
container of the currently selected control (if the currently selected
control is not itself a control container). So, if you want to add a panel
that is a direct child of the form, make sure the form itself is selected
(sizing icons appear around form border), and double-click the panel control
in the toolbox.

Second, docking is very useful. Create a panel to hold the "navigation"
buttons at the bottom of the screen. Set the Dock property to "Bottom". Add
n number of "page" panels to the form using the above method. Select all the
page panels and set the Dock property to "Fill". You can cycle which page
panel is visible in the designer by right-clicking on the currently visible
page panel and choosing "Send to Back".

Regards,
Daniel
 
Back
Top