visual elements delay when "bringtofront"

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.
Post Reply
allteck
Posts: 3
Joined: Wed Aug 21, 2019 3:18 pm

visual elements delay when "bringtofront"

Post by allteck » Thu Aug 22, 2019 2:18 pm

Using Powershell Studio 2019.

I'm working on a small multi form application in which the main form has been configured with multiple overlay'd panels. When a button is pressed in a side menu, it brings the associated panel to the front.

To do this i'm using $panel1.location = $panel2.location, $panel#.bringtofront / .bringtoback and $panel.visible = $true / $false. Perhaps this is overkill or causing this problem? better options exist?

While this works well, I'm finding that some elements show before others. I'm using 1px panels as underlines for flat textboxes(visual styling workaround) which are all showing first before the remaining elements. Thus when the menu is selected, I see all the 1px lines and then .5 seconds later it shows everything else. These 1px panels are spread out in the main sub panel and within other sub panels, all of which show at the same time. The other larger panels which container some of these elements show up with everything else after the 1px panels.

Any possible solution to fix this? Is there a reason these panel's load before other panels in the same panel?

I suspect someone will tell me to use tabcontrol instead (which may fix this issue) but unfortunately I couldnt get it to work as I wanted. The major hurdle with this is after hiding the tabs, I couldnt change the tabcontrol border color to match my styling which looked horrible. If anyone has a powershell method to update the tabcontrol background (plus hidden tabs), im all ears.

Any help would be great, thanks!

User avatar
jvierra
Posts: 13732
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: visual elements delay when "bringtofront"

Post by jvierra » Thu Aug 22, 2019 2:44 pm

Is this what you are trying to ask?
Attachments
Text-Panels.psf
(44.95 KiB) Downloaded 8 times

allteck
Posts: 3
Joined: Wed Aug 21, 2019 3:18 pm

Re: visual elements delay when "bringtofront"

Post by allteck » Fri Aug 23, 2019 9:10 am

In regards to the panel switching, yes, thats what I have set up. As for the underline issue, no.

Attached is your psf edited with an example. The blue background panel is similar to what i'm using but I have about 6 of these fields. Using a label, textbox then panel as an underline to the textbox with the textbox having no border and blending into the background. The issue i'm facing is that when the panel is set to "bringtfront", the panel shows, then the 1px panel "underline" shows, THEN everything else loads in. Thus I see all the 1px panels first before all other elements.

If needed I can post my psf but i'll have to modify out a bunch of data due to confidentiality.

Thanks for the help!
Attachments
Text-Panels2.psf
(56.41 KiB) Downloaded 6 times

allteck
Posts: 3
Joined: Wed Aug 21, 2019 3:18 pm

Re: visual elements delay when "bringtofront"

Post by allteck » Fri Aug 23, 2019 9:29 am

As a test I moved my panels to a new psf and tested. The issue did not happen so it made my realize something in my code must be the problem.

I was using the .visible as well as .bringtofront() and from your example I realized the .bringtofrint() was not needed. Removing this alone didnt help but after reordering the sequence the issue is now resolved.

I now have it making the background panel visible = $true then the foreground panel as visible = $false. In this order and being the first commands in the click, the issue appears to be resolved. I have a few other commands in the click as well for changing the menu button appearance which were coming first. This likely also caused some delays. Its still weird why just the 1px panels loaded in first though.

Thanks for the help! it made me realize where I made a mistake.

Cheers.

Post Reply