Modal forms

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 4 years and 5 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
localpct
Posts: 397
Last visit: Thu Oct 27, 2022 5:57 am

Modal forms

Post by localpct »

So I've successfully created a modal form using viewtopic.php?f=21&t=14109&p=74346&hili ... rms#p74346

Is there a way to update the modal form with new info from the main form? IE, I change the PC name in the name form, I would like it to update the childform with the new PC name via a button click
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Modal forms

Post by jvierra »

There is no direct way to do this as a modal form is just that - it is modal to the form that creates it. All code in the main form is frozen until the child form is closed.
Why do you think you need to do this.
User avatar
localpct
Posts: 397
Last visit: Thu Oct 27, 2022 5:57 am

Re: Modal forms

Post by localpct »

It would be nice to update just the main form with the new PC number, click my refresh button, and the child form is updated

Instead of closing the child form, and reopening it
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Modal forms

Post by jvierra »

You can't. The main form is frozen while the child is displayed.
Why is this necessary?
User avatar
localpct
Posts: 397
Last visit: Thu Oct 27, 2022 5:57 am

Re: Modal forms

Post by localpct »

ease of use
I have no requirements on this, even the modal form is just a cool feature
User avatar
localpct
Posts: 397
Last visit: Thu Oct 27, 2022 5:57 am

Re: Modal forms

Post by localpct »

jvierra wrote: Wed Oct 16, 2019 10:26 am You can't. The main form is frozen while the child is displayed.
Why is this necessary?
I can absolutely use the main form while my child form is display, the main form just won't pass a variable to the child form
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Modal forms

Post by jvierra »

You would have to provide an example of the code that does this. If the child is started from a button then the main form will not be accessible.
User avatar
localpct
Posts: 397
Last visit: Thu Oct 27, 2022 5:57 am

Re: Modal forms

Post by localpct »

Well I just used your example and built from that
see in my OP your demo app
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Modal forms

Post by jvierra »

That demo does not allow access to the main form while the modal child is displayed so it is not possible to understand what you are getting at.
User avatar
localpct
Posts: 397
Last visit: Thu Oct 27, 2022 5:57 am

Re: Modal forms

Post by localpct »

Hopefully this helps, as you can see, the main form is accessible while the child form is displayed

https://1drv.ms/v/s!Au_ZweY6A8F2gYIRFxW ... g?e=LgeWdg
This topic is 4 years and 5 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