i press enter on my forms and they close

Ask your PowerShell-related questions, including questions on cmdlet development!
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 5 years and 4 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
User avatar
jsira2003@yahoo.com
Posts: 117
Last visit: Tue Jul 11, 2023 6:18 am

i press enter on my forms and they close

Post by jsira2003@yahoo.com »

I am sure this is a simple problem to resolve. Unfortunately the resolve didn't come to me. How can I resolve this so instead of the form closing it will advance to the next data entry field.

thank you,
John
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: i press enter on my forms and they close

Post by jvierra »

You have to remove the default button which will always click when return is entered.
User avatar
Alexander Riedel
Posts: 8479
Last visit: Thu Mar 28, 2024 9:29 am
Answers: 19
Been upvoted: 37 times

Re: i press enter on my forms and they close

Post by Alexander Riedel »

https://www.sapien.com/blog/2015/12/23/how-i-learned-to-love-dialogresult/
Alexander Riedel
SAPIEN Technologies, Inc.
User avatar
jsira2003@yahoo.com
Posts: 117
Last visit: Tue Jul 11, 2023 6:18 am

Re: i press enter on my forms and they close

Post by jsira2003@yahoo.com »

I looked for the dialogresult to set it to none. But it seems this assumes you have a button to click on otherwise you do not have a dialogresult to set. My form just has a red X in the upper right. I want the user to move through the fields and when they are done press the red x to exit. I do not want a return pressed key to exit the app.

I hope I have explained this well.

John
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: i press enter on my forms and they close

Post by jvierra »

You created a dialog form and deleted the "Ok" button but the form is still terminating. Somewhere in your form you are processing the return key and exiting. Perhaps the OK button is hiding somewhere. Check the controls list to see if it is still on the form but hidden.
This topic is 5 years and 4 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