multiform

Ask questions about creating Graphical User Interfaces (GUI) in PowerShell and using WinForms controls.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 6 years and 10 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
mrosema
Posts: 7
Last visit: Mon Apr 02, 2018 9:35 am

multiform

Post by mrosema »

I want to create a multi form GUI where you can navigate to multiple forms.
I would like to know how you can close the screen when a new form opens.
For example from the main page I go to a sub form, after the sub form opens, the main needs to be closed.
How it this possible?
For opening a subform I use the command Call-ChildItem_psf! Is this correct?
Can I use Call or Show for the best result?
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: multiform

Post by jvierra »

You can't. Modal forms cannot close the parent form. The parent form holds the definition of the child form. Closing it would also destroy the child form.
User avatar
mrosema
Posts: 7
Last visit: Mon Apr 02, 2018 9:35 am

Re: multiform

Post by mrosema »

What will be the best solution to do here? Do you have some examples for multi form applications?
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: multiform

Post by jvierra »

A child can close and the main form can open a new child.

The answer to your question is highly dependent on what you are trying to do.
User avatar
mrosema
Posts: 7
Last visit: Mon Apr 02, 2018 9:35 am

Re: multiform

Post by mrosema »

The idea is to create a application for Powershell. On the main form you get different options to choose like AD, Exchange, etc. After clicking on one of these subjects a new form opens which has different options like report possibilities for searching the AD, but also creating a new AD account (this will also be in a new screen). The application will get more and more possibilities and will need to function with a lot of forms.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: multiform

Post by jvierra »

There is no need to close the main form. The child will always block the main and work as an independent form.

Before you set out on this I recommend that you become skilled at PowerShell and learn how to build and manage single forms. After you are adept at that you can then seek a design that meets your needs within the limits of PowerShell Forms.

In a Windows application we use modeless forms. In PowerShell we are limited to using only modal forms. With modal forms only one form can be active at any one time. PowerShell is not a GUI program and can only display modal dialogs.

There is one way to get multiple forms that are somewhat independent. That is t use an MDI form and MDI child forms. PowerShell studio has no direct support for creating MDI child forms so the forms have to be created by hand or by custom edits to the PSF files. This is a very advanced technique and requires advanced knowledge of forms and programming as well as proficient PowerShell skills.
User avatar
mrosema
Posts: 7
Last visit: Mon Apr 02, 2018 9:35 am

Re: multiform

Post by mrosema »

What are the possibilities for navigating through the application with Powershell Studio? You don't want to have multiple forms open when navigating. What is the best way to do this?
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: multiform

Post by jvierra »

I don't understand. You can only have one active form. The top form can be the only active form. PSS does not do anything that PowerShell cannot do and adds nothing that PowerShell can't do.
You cannot open multiple independent forms.

A modal dialog can only open one other modal dialog and that dialog can open one dialog. The last one opened is the only active dialog.

As I noted above. MDI forms can have multiple open forms that are mostly independent.

Here is a quick demo of an MDI form.
Attachments
Demo-MDIForm.ps1
(6.72 KiB) Downloaded 183 times
User avatar
localpct
Posts: 397
Last visit: Thu Oct 27, 2022 5:57 am

Re: multiform

Post by localpct »

I think his problem is the same as mine Image

We're stuck with the main form always showing in one way or another. I'm still working on something pretty.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: multiform

Post by jvierra »

As I said before. You cannot close or hide the parent form in a Windows dialog.
This topic is 6 years and 10 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked