Modal forms
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.
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.
Re: Modal forms
Without you code it is not possible to understand the issue. The child form is clearly NOT a modal form. It is either launched in a separate runspace or launched using a couple of other little known tricks that allow "modeless" forms. These tricks do not work correctly with forms in PowerShell but can be used in limited ways.,
Re: Modal forms
viewtopic.php?f=21&t=14109&p=74346&hili ... rms#p74346
I just used this in the demo
So yes its a runspace
I just used this in the demo
So yes its a runspace
Re: Modal forms
Yes - that form is NOT a modal form. It is a form running in a separate runspace. The only way to access the form is to modify variables in the synchash and have to child form detect when the variable is modified.
Re: Modal forms
I modified the example to demonstrate how to communicate with a form via the synchash. It shows two methods for altering the a second main form from the creating form. I use the name "Parent" in the synchash but the form is not a true "Parent" as defined by the form's "Parent" property but it does parent the disconnected form in a way. I suppose "CreatingForm" or "OwningForm" would be a better name to prevent confusion.
Run this demo to see how to manage a disconnected form (A "Child" form is a "connected" form in that it is always attached to the form the creates it even if it does this by calling a function or script. This is because PowerShell is a single thread. A runspace is a new thread so we can get away with much mischief without disturbing the main PowerShell thread. Of course this all requires some advanced programming and systems skills that aer not found in most WIndows techs and even not understaood by many programmers.
See the attached project.
Run this demo to see how to manage a disconnected form (A "Child" form is a "connected" form in that it is always attached to the form the creates it even if it does this by calling a function or script. This is because PowerShell is a single thread. A runspace is a new thread so we can get away with much mischief without disturbing the main PowerShell thread. Of course this all requires some advanced programming and systems skills that aer not found in most WIndows techs and even not understaood by many programmers.
See the attached project.
- Attachments
-
- Demo-MultFormClientRS.zip
- (158.01 KiB) Downloaded 104 times
Re: Modal forms
So I want to be clear, and just need a yes no answerjvierra wrote: ↑Thu Oct 17, 2019 12:04 pm I modified the example to demonstrate how to communicate with a form via the synchash. It shows two methods for altering the a second main form from the creating form. I use the name "Parent" in the synchash but the form is not a true "Parent" as defined by the form's "Parent" property but it does parent the disconnected form in a way. I suppose "CreatingForm" or "OwningForm" would be a better name to prevent confusion.
Run this demo to see how to manage a disconnected form (A "Child" form is a "connected" form in that it is always attached to the form the creates it even if it does this by calling a function or script. This is because PowerShell is a single thread. A runspace is a new thread so we can get away with much mischief without disturbing the main PowerShell thread. Of course this all requires some advanced programming and systems skills that aer not found in most WIndows techs and even not understaood by many programmers.
See the attached project.
If on my main form, I change a textbox to reflect the new PC name, can this code you put together, update a textbox on the disconnected childform? I see I can use this code to update the Title of the form, but can't seem to figure out how to change a textbox
Re: Modal forms
Here is the missing piece that you need to understand how to easily access the objects in a remote form.
- Attachments
-
- Demo-MultFormClientRS2.zip
- (200.57 KiB) Downloaded 109 times