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.
User avatar
jamesearl
Posts: 11
Joined: Mon Oct 22, 2012 4:44 pm

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
Joined: Thu Aug 18, 2011 4:56 am

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
Joined: Mon Oct 22, 2012 4:44 pm

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
Joined: Thu Aug 18, 2011 4:56 am

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
Joined: Mon Oct 22, 2012 4:44 pm

Simulate a button being clicked in a form.

Post by jamesearl »

Thanks you for that. That's really what I want to do :)