2019 -> 2021 psf updates break formatting

Use this forum to ask questions after your subscription maintenance expires or before you buy. Need information on licensing or pricing? Questions about a trial version? This is the right place for you. No scripting questions, please.
Forum rules
DO NOT POST SUBSCRIPTION NUMBERS, LICENSE 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.
User avatar
robert.ganshorn
Posts: 54
Last visit: Thu May 20, 2021 3:23 pm

2019 -> 2021 psf updates break formatting

Post by robert.ganshorn »

Product, version and build: 5.8.187
Operating system: Windows 10
PowerShell version(s): 5
32-bit version of software? No

I have many scripts that were created with PS Studio 2019. I am now using PS Studio 2021 (5.8.187) and when I load the PSF, they are 'upgraded'. The script looks fine in the editor, but when running the script some checkbox text and radiobox text are not formatted correctly.

View in editor and also how the script looks when running as deployed in PS Studio 2019
Editor View.jpg
Editor View.jpg (28.35 KiB) Viewed 2236 times
View of script as it actually runs after being 'upgraded' by PS Studio 2021
actual view.jpg
actual view.jpg (23.11 KiB) Viewed 2236 times
Autosize is enabled on these items.

User avatar
brittneyr
Site Admin
Posts: 789
Last visit: Fri Jun 11, 2021 2:05 pm
Answers: 15
Been upvoted: 11 times

Re: 2019 -> 2021 psf updates break formatting

Post by brittneyr »

There was changes to the generated code in 2020 for the release of PowerShell 7 as well as changes to frameworks that PowerShell Studio was built with which may have caused this. I recommend anchoring controls to ensure they properly size.

You also say 'deployed', was your original form packaged as an executable?
Brittney Ryn
SAPIEN Technologies, Inc.

User avatar
robert.ganshorn
Posts: 54
Last visit: Thu May 20, 2021 3:23 pm

Re: 2019 -> 2021 psf updates break formatting

Post by robert.ganshorn »

The original was PS1. I generally don't export to exe unless absolutely necessary.

The issue is happening because the autosize attribute value is not being written in the code even though it's set in the PSF file. When I manually add $checkboxDoNotResetPassword.autosize = $True, the text is displayed correctly.

This is happening to checkboxes and radiobuttons. I have these controls in a groupbox.

New code missing autosize:
  1. # checkboxDoNotResetPassword
  2.     #
  3.     $checkboxDoNotResetPassword.Enabled = $False
  4.     $checkboxDoNotResetPassword.ForeColor = [System.Drawing.Color]::Black
  5.     $checkboxDoNotResetPassword.Location = New-Object System.Drawing.Point(40, 427)
  6.     $checkboxDoNotResetPassword.Margin = '5, 5, 5, 5'
  7.     $checkboxDoNotResetPassword.Name = 'checkboxDoNotResetPassword'
  8.     $checkboxDoNotResetPassword.Size = New-Object System.Drawing.Size(201, 25)
  9.     $checkboxDoNotResetPassword.TabIndex = 27
  10.     $checkboxDoNotResetPassword.Text = 'Do not reset password'
  11.     $checkboxDoNotResetPassword.UseCompatibleTextRendering = $True
  12.     $checkboxDoNotResetPassword.UseVisualStyleBackColor = $True
  13.     $checkboxDoNotResetPassword.add_CheckedChanged($checkboxDoNotResetPassword_CheckedChanged)
  14.     #
  15.    

User avatar
robert.ganshorn
Posts: 54
Last visit: Thu May 20, 2021 3:23 pm

Re: 2019 -> 2021 psf updates break formatting

Post by robert.ganshorn »

I would think this is a bug.

User avatar
brittneyr
Site Admin
Posts: 789
Last visit: Fri Jun 11, 2021 2:05 pm
Answers: 15
Been upvoted: 11 times

Re: 2019 -> 2021 psf updates break formatting

Post by brittneyr »

We will investigate this and get back to you soon.
Brittney Ryn
SAPIEN Technologies, Inc.

User avatar
robert.ganshorn
Posts: 54
Last visit: Thu May 20, 2021 3:23 pm

Re: 2019 -> 2021 psf updates break formatting

Post by robert.ganshorn »

I hope this gets fixed soon since it could affect alot of scripts I have.

User avatar
brittneyr
Site Admin
Posts: 789
Last visit: Fri Jun 11, 2021 2:05 pm
Answers: 15
Been upvoted: 11 times

Re: 2019 -> 2021 psf updates break formatting

Post by brittneyr »

So far we have not been able to reproduce this. Does this happen on other forms as well or just this one? Is the AutoSize property set to true when you open the form up in the designer?
Can you please upload a sample form that demonstrates this behavior:
https://www.sapien.com/support/upload
Brittney Ryn
SAPIEN Technologies, Inc.

User avatar
robert.ganshorn
Posts: 54
Last visit: Thu May 20, 2021 3:23 pm

Re: 2019 -> 2021 psf updates break formatting

Post by robert.ganshorn »

I've uploaded the psf and exported ps1.

If you run the PSF from within PS Studio, you can hopefully see the issue.
I may have had autosize turned off for the password reset checkbox from testing

Rob

User avatar
robert.ganshorn
Posts: 54
Last visit: Thu May 20, 2021 3:23 pm

Re: 2019 -> 2021 psf updates break formatting

Post by robert.ganshorn »

Actually the issue may not be autosize related at all, but something with the font scaling or dpi. I'm just not sure. Running a script from PS Studio also seems to scale differently as opposed to if it was deployed to ps1 and run standalone.

It seems very much trial and error at this point trying to figure this out.

Rob