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 4 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.
I have a GUI with a label which is not visible ($false). I would like to visible the item with BeginInvoke(). So long the task is running, the item is visible and when finished not.
How I could change this settings for my label and other items? When I do this in my script ($label.InvokeRequired = $true), it´s not working while it´s a read only property.
Invoke is not required to change properties. It is only required for calling delegates. Just set the property. The synchash will handle threading issues.
You must use a synchash and not just assigned variables.
Here is the way to create a basic invokable script that builds and manages the runspace for you with correct default values and a synchash.
Since the "Visible" property is not really a simple property you would have tocreate a delegate that can calll the "Show()" method on the control. I can't remember the syntax for that in PowerShell right now.
The "InvokeRequired" is not needed here and is not a settable property. It is used so a thread can decide whether to directly access a control or if an "Invoke" is required.
This topic is 4 years and 4 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.