Source language: Translate to:

Simulate button Click

General questions about NeoAppBuilder - our rapid application development tool for building HTML5, web and mobile apps.

Moderator: Neosoft Support

Simulate button Click

Postby PaulTomo » Wed May 27, 2015 12:42 am

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
User avatar
PaulTomo
 
Posts: 62
Joined: Tue Apr 28, 2009 1:15 am
Location: UK

Re: Simulate button Click

Postby Gaev » Wed May 27, 2015 5:48 am

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.
User avatar
Gaev
 
Posts: 3728
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: Simulate button Click

Postby luishp » Thu May 28, 2015 4:22 am

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
Luis Hernández - SinLios Soluciones Digitales
http://sinlios.com
User avatar
luishp
 
Posts: 359
Joined: Wed May 23, 2007 10:17 am
Location: Spain

Re: Simulate button Click

Postby PaulTomo » Thu May 28, 2015 10:45 am

luishp

Thanks for this, I'll give it a try
User avatar
PaulTomo
 
Posts: 62
Joined: Tue Apr 28, 2009 1:15 am
Location: UK


Return to General NeoAppBuilder Discussion

Who is online

Users browsing this forum: No registered users and 2 guests