Simulate a button being clicked in a 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 11 years and 5 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
jamesearl
Posts: 11
Last visit: Tue May 30, 2023 10:40 am

Simulate a button being clicked in a form.

Post by jamesearl »

First I must say that I'm still learning Primal Forms. I have a form created with a 'Yes' and 'No' button. I also created a countdown timer which displays the seconds until the form auto continues. I do have the count down timer working. How do I simulate the 'Yes' button was clicked after the timer has finished?
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Simulate a button being clicked in a form.

Post by davidc »

You can set the form's DialogResult to 'Yes' and then close the form:

$form1.DialogResult = 'Yes'
$form1.Close()

For more details on the Form and Button I recommend reading the following Spotlight articles:

http://www.sapien.com/blog/2011/06/01/p ... m-control/

http://www.sapien.com/blog/2011/06/07/p ... n-control/

David
David
SAPIEN Technologies, Inc.
User avatar
jamesearl
Posts: 11
Last visit: Tue May 30, 2023 10:40 am

Simulate a button being clicked in a form.

Post by jamesearl »

davidc,
Thanks for the reply but it didn't work for want I needed to do. I wanted the button_click section to perform after the time ran out. I found that I just needed to perform the PerformClick() method and that worked.

Thanks again.
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Simulate a button being clicked in a form.

Post by davidc »

You could also trigger the event block to execute as well:

&$button1_Click

David
David
SAPIEN Technologies, Inc.
User avatar
jamesearl
Posts: 11
Last visit: Tue May 30, 2023 10:40 am

Simulate a button being clicked in a form.

Post by jamesearl »

Thanks you for that. That's really what I want to do :)
This topic is 11 years and 5 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.