Page 1 of 1

visual elements delay when "bringtofront"

Posted: Thu Aug 22, 2019 2:18 pm
by allteck
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!

Re: visual elements delay when "bringtofront"

Posted: Thu Aug 22, 2019 2:44 pm
by jvierra
Is this what you are trying to ask?

Re: visual elements delay when "bringtofront"

Posted: Fri Aug 23, 2019 9:10 am
by allteck
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!

Re: visual elements delay when "bringtofront"

Posted: Fri Aug 23, 2019 9:29 am
by allteck
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.