GroupBox visibility property and debugging

This forum can be browsed by the general public. Posting is limited to current SAPIEN license holders with active maintenance and does not offer a response time guarantee.
Forum rules
DO NOT POST LICENSE NUMBERS, ACTIVATION KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.

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 3 years and 11 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.
User avatar
Lembasts
Posts: 406
Last visit: Mon Apr 15, 2024 3:12 pm
Has voted: 1 time
Been upvoted: 1 time

GroupBox visibility property and debugging

Post by Lembasts »

To help you better we need some information from you.

*** Please fill in the fields below. If you leave fields empty or specify 'latest' rather than the actual version your answer will be delayed as we will be forced to ask you for this information. ***

Product, version and build: 174
32 or 64 bit version of product:64
Operating system:win10 1909
32 or 64 bit OS:64

Greetings,
During debugging the Groupbox visible property remains as false even when set to true. However the code functions as though its set to true.
I have attached the project code for you to test.
In mainform.psf, set a breakpoint at line 8 after the assignment of the visible property. When you hit the breakpoint, check the visible property of $groupbox1. In my debugger it reports as false even though it has been set to true. Then press F5 - the next tab displays the groupboxes correctly!
Is it just me or can you replicate it?
Thanks
David
Attachments
groupboxtest.zip
(27.96 KiB) Downloaded 112 times
User avatar
Olga_B
Site Admin
Posts: 196
Last visit: Mon Apr 15, 2024 12:32 pm

Re: GroupBox visibility property and debugging

Post by Olga_B »

David,
visible properties will be updated after you click Next button
1. Ste Breakpoint at line 8
2. Press F5 - form is displayed
3. On form click Next button
4. Check properties - they are updated
User avatar
Lembasts
Posts: 406
Last visit: Mon Apr 15, 2024 3:12 pm
Has voted: 1 time
Been upvoted: 1 time

Re: GroupBox visibility property and debugging

Post by Lembasts »

What happens if you put an If statement after the assignment?
GroupBox1.visible = $true
If ($groupbox1.visible) {...}
That will not work out to be true even though I just assigned true.
User avatar
brittneyr
Site Admin
Posts: 1669
Last visit: Fri Apr 12, 2024 2:35 pm
Answers: 39
Been upvoted: 31 times

Re: GroupBox visibility property and debugging

Post by brittneyr »

This behavior has to do with how winforms works with this type of control. The groupbox is a 'container control' meaning it hosts other controls inside of it. These type of controls also determine visibility by the parent control's visibility, not just the value set by the user. In this instance, the parent is $tabpage2 is not visible at the time when $buttonNext click event is starting. Not until after line 8 ($tabcontrol1.SelectedTab = $tabpage2), $groupbox1 should still return false as $tabpage2 is not yet visible.

This behavior should also be consistent for other container controls such as the panel and flowlayout panel.
Brittney
SAPIEN Technologies, Inc.
User avatar
Lembasts
Posts: 406
Last visit: Mon Apr 15, 2024 3:12 pm
Has voted: 1 time
Been upvoted: 1 time

Re: GroupBox visibility property and debugging

Post by Lembasts »

Thanks - that explains it. I found this out because I was doing an if test in tab1. I am now assigning $true to $groupbox1.tag as well as a workaround.
This topic is 3 years and 11 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.