Is there a way to see the code when creating a GUI form?

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 1 year and 2 days 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
jgq1985
Posts: 23
Last visit: Thu Dec 07, 2023 7:30 am

Is there a way to see the code when creating a GUI form?

Post by jgq1985 »

If I'm creating a GUI in PS Studio, say I add a label to the form. Well when I click the script/code, I cannot see where my label is in the code.
Is this always being hidden from development as well as when compiling?
I have a childform psf on a multi-form for example and I added a label to it on the Designer tab/screen.
When I click the "Script" tab, all I see is:

$formChildForm_Load={
#TODO: Initialize Form Controls here

}

If I export it to a File, I can open the .ps1 and see my label there in the code.

Is there a way to just show all of the actual "script" under the "script" tab?




Product, version and build:
Operating system: Windows 10
PowerShell version(s): 5.7.172
User avatar
brittneyr
Site Admin
Posts: 1655
Last visit: Thu Mar 28, 2024 3:14 pm
Answers: 39
Been upvoted: 30 times

Re: Is there a way to see the code when creating a GUI form?

Post by brittneyr »

No, this was intentional. All form data is stored in the PSF as XML. Objects are serialized and de-serialized in XML. When you run or package a PSF, PowerShell Studio is generating the code from the XML alongside your code into a PS1.

You can always export your PSF to a PS1 (Deploy->Export) and see the actual code. It is important to note you should not recovery any modified exported script back to a PSF.

You may find the following article helpful:
https://www.sapien.com/blog/2022/01/04/ ... ll-studio/
Brittney
SAPIEN Technologies, Inc.
User avatar
jgq1985
Posts: 23
Last visit: Thu Dec 07, 2023 7:30 am

Re: Is there a way to see the code when creating a GUI form?

Post by jgq1985 »

Is there no way to see elements that are on the GUI in the code?
If I'm double-clicking a button to add an event, I like to see/reference what other elements by name are on the GUI, like maybe I want to change a $label to certain text. Not seeing it anywhere in the code makes it harder to have to remember/reference things I want to manipulate with the button, no?
I was using AdminScriptEditor before and being able to actually see what's in my code that's added from the Toolbox makes things 100% more efficient.
User avatar
brittneyr
Site Admin
Posts: 1655
Last visit: Thu Mar 28, 2024 3:14 pm
Answers: 39
Been upvoted: 30 times

Re: Is there a way to see the code when creating a GUI form?

Post by brittneyr »

Under the Script tab, you should see all form objects from PrimalSense when you type '$' with the autocomplete functionality.
Brittney
SAPIEN Technologies, Inc.
User avatar
jgq1985
Posts: 23
Last visit: Thu Dec 07, 2023 7:30 am

Re: Is there a way to see the code when creating a GUI form?

Post by jgq1985 »

Yeah this is weird how am I supposed to change a label text for example when the Child Form opens?
On my ChildForm I have a Label called $Label1

I'm trying a simple test to change the text when the ChildForm opens up, but it doesn't change to the "Testing123" text. It just stays as the "Label1" text when I added it to the GUI.

Is there something else you have to do?
I can update it by adding a click event, but I want it to update when the form opens because I'm going to make a timer to update it as a countdown timer so that'll have to happen right when the form loads

Code: Select all

#This doesn't change the text
$formChildForm_Load={

	
	$Label1.Text = "Testing123"
}


#this does change the text
$Label1_Click={
	
	$Label1.Text = "Testing123"
}

User avatar
brittneyr
Site Admin
Posts: 1655
Last visit: Thu Mar 28, 2024 3:14 pm
Answers: 39
Been upvoted: 30 times

Re: Is there a way to see the code when creating a GUI form?

Post by brittneyr »

Can you upload your script so I can better assist you?
https://www.sapien.com/support/upload

Please make sure all forms objects you are currently referencing are present from the Design tab and all events are registered to the objects.

You may find the following article helpful:
https://www.sapien.com/blog/2022/08/03/ ... -projects/
https://www.sapien.com/blog/2015/07/16/ ... o-i-start/
https://www.sapien.com/blog/2021/11/23/ ... ll-studio/
https://www.sapien.com/blog/2018/04/12/ ... -handlers/
Brittney
SAPIEN Technologies, Inc.
This topic is 1 year and 2 days 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.