Can I call other control's Event?


Yang Ghua

For example
How can I trigger Button2's Click Event in Button1's Click Event?


DecSoft

Hello Joshua,

Please, take a look at the "External" app sample, and, particularly to the "Button2" "Click" event. Take also a look at the External Javascript tutorial.



Yang Ghua

OK,Got it


Alex Alexei

Hello David,

I've looked at a couple of your examples including 'SimulatePress', however I can't seem to find any reference to how you would fire the 'File Control' the same way a 'Label Control' would by putting the 'File Control' Behaviour Name into the 'Label Control' Visual Input field.
If JS is the way, is a variation on the following code whats needed 'window.App.NewView1.Scope.Input1Click();' or is the 'File Control's 'Input1.Event' the better approach?
The goal is (by adding variables) to use one 'HTML Control' to select more than one file (one after the other using multiple 'File Controls') on the users local storage.
Any help would be much appreciated.


DecSoft

Hello Alex,

Thanks for posting. I am not sure if can understand very well exactly what you wanted or need, since, you talk about files but also about the app's local storage. Please, in order to try to help you, can you say if what you want is to upload one or more files to an app's server? Did you know that we can already use more than one Input File control in an app's view?

Certainly, everything we can do in Javascript is also suitable in our AB applications, but, I am not sure if we really need some external JS here or what. Additionally, if you think that you can explain a little more what you need to do, maybe, in addition to some specific help, we can also start to think into another possible approach to do what you wanted.



Alex Alexei

Thanks for getting back so quickly. Currently I have my 'File Control' named 'Input1' placed outside the viewable area. In the view I have a 'Label Control' with 'Input1' in the Visual Input field in the properties nothing else. This opens up the users local file browser when you select the label at runtime.
I would like to remove the 'Label Control' and replace it with a 'Html Control' to achieve the same result at runtime! My intention is to use an array connected to the 'Html Control' to fire multiple 'Input File Controls'.


DecSoft

Hello Alex,

The "connection" between a Label and an Input control (no matter if they are a File Input or any other) is the "for" attribute in the label element. That is, certainly is possible to add a label in an HTML control in that way, for example:

Note, however, that the Input File control is a bit special, in the sense that some browsers (the WebView on Android 4.x, for example) disallow to play with non visibles Input File controls. What you can do to pass around this is to place the Input File control(s) below than other controls (using the "z-index" CSS rule) in order to set it non visible, but wihout hide it completely.

Alex, at this point I am not sure if the above can be enough for you. Please, don't hesitate to post here any further questions that you have and I will try to help you. Almost always we can try several approachs to get what we wanted. For example, I am not sure why to use an HTML control here, since we can place any controls in a view in order to be "scrolled down": look a look at the "InputScroll" and "InputScroll2" samples.



Alex Alexei

That's great! It seems to do what I am after, thanks. Going to test it a little more. I have the label wrapped around a table within the 'Html Control' Visual Input field. It messed with the layout a bit until the first entry in the table is acquired ie. Input1; but am sure I'll figure it out.
Will also look at the 'z-index' CSS rule. I had the test app fail opening up the local file browser on older devices but seemed to work fine on newer ones. Do you have an app sample or tutorial that demonstrates or refers to this 'CSS rule'?

Thanks again David, App Builder is awesome!


DecSoft

Hello Alex,

Thanks for your kindly words. Please, take a look at this app sample. In the sample you can see two things: how to use an Image control and their "z-index" CSS rule in order to place on top of certain Input File control. Doing this we no need to hide the Input File control, who can cause problems, as you know, in older browsers. The sample also show how we can launch the Input File "dialog" using a label and also programmatically using the Image control's Click event.

Hope that sample can be useful for you, Alex, and, please, don't hesitate to post any other questions you have.



Alex Alexei

Thanks will do! - that Javascript may also come in very handy as an alternative to the 'Label for' also... :)


DecSoft

Hello to all,

Thanks will do! - that Javascript may also come in very handy as an alternative to the 'Label for' also... :)

You're welcome Alex!


Everybody can read the DecSoft support forum for learning purposes, however only DecSoft customers can post new threads. Purchase one or more licenses of some DecSoft products in order to give this and other benefits.

This website uses some useful cookies to store your preferences.

I agree. Hide this note. Give me more information.