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.
This topic is 4 years and 7 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
allteck
Posts: 3
Last visit: Thu Mar 14, 2024 8:51 am

visual elements delay when "bringtofront"

Post 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!
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: visual elements delay when "bringtofront"

Post by jvierra »

Is this what you are trying to ask?
Attachments
Text-Panels.psf
(44.95 KiB) Downloaded 72 times
allteck
Posts: 3
Last visit: Thu Mar 14, 2024 8:51 am

Re: visual elements delay when "bringtofront"

Post 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!
Attachments
Text-Panels2.psf
(56.41 KiB) Downloaded 77 times
allteck
Posts: 3
Last visit: Thu Mar 14, 2024 8:51 am

Re: visual elements delay when "bringtofront"

Post 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.

Cheers.
This topic is 4 years and 7 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