Page 1 of 1

Simulate button Click

PostPosted: Wed May 27, 2015 12:42 am
by PaulTomo
Just wondered if the "ClickMouse" function in NeoBook could be added or if anyone knows how it is possible to do this in NeoAppBuilder?

I have searched around and found some JS suggestions but none seem to work.

All I'm after is that when I click on one button, it performs the action from a second button too, as an example a Form Submit, to save the user having to click on the Submit as well. One less button click.

Any Ideas, examples?

Thanks

Paul

Re: Simulate button Click

PostPosted: Wed May 27, 2015 5:48 am
by Gaev
PaulTomo:

Just wondered if the "ClickMouse" function in NeoBook could be added or if anyone knows how it is possible to do this in NeoAppBuilder?
I have searched around and found some JS suggestions but none seem to work.

For security reasons, I don't believe you can do that ... e.g. imagine if a Button labelled "Delete All Files" or "Buy this $45,000 Apple Watch" could have its click action simulated.

Also, Apple will not service certain requests in the "onload scripts" (e.g. download/play music/videos) ... has to be part of a user initiated script ... being able to simulate a click event would allow you/I to do an end run around it.

All I'm after is that when I click on one button, it performs the action from a second button too, as an example a Form Submit, to save the user having to click on the Submit as well. One less button click.

Any Ideas, examples?

Now that is a very reasonable requirement ... but you don't have to "simulate the click action of the button" in order ot achieve your goal.

Say you have buttons A, B, C etc. ... make sure that the click responses of each button are stored in a subroutine e.g. onClickA, onClickB etc. ... so, the code in the click-event is just a simple GoSub to the appropriate subroutine ... now if you need to perform the click response of another button, just add a GoSub for the other subroutine ... either in the click-event section or in the subroutine associated with the click of the first Button.

Re: Simulate button Click

PostPosted: Thu May 28, 2015 4:22 am
by luishp
I have found it is possible to simulate a button click from another button, although standard JavaScript .click() method does not work.
Lets say we have two buttons: PushButton1 and PushButton2.
Using this code on PushButton2, the code at PushButton1 will be executed:

Code: Select all
BeginJS
$scope.PushButton1_click();
EndJS


It also works to fire other events like:

Code: Select all
BeginJS
$scope.PushButton1_mouseenter();
$scope.PushButton1_mouseleave();
$scope.PushButton1_mouseup();
$scope.PushButton1_mousemove();
EndJS

Re: Simulate button Click

PostPosted: Thu May 28, 2015 10:45 am
by PaulTomo
luishp

Thanks for this, I'll give it a try