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.
User avatar
Lembasts
Posts: 265
Meble kuchenne na zamówienie - na wymiar - Wrocław
Joined: Thu Mar 15, 2012 9:47 am

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 15 times

User avatar
Olga_B
Site Admin
Posts: 146
Joined: Mon May 15, 2017 9:06 am

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: 265
Joined: Thu Mar 15, 2012 9:47 am

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: 432
Joined: Thu Jun 01, 2017 7:20 am

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 Ryn
SAPIEN Technologies, Inc.

User avatar
Lembasts
Posts: 265
Joined: Thu Mar 15, 2012 9:47 am

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.