Rizal Putra Member Licensed User Longtime User Mar 23, 2014 #1 What can I do to press the button through code, without knowing EventName of a button or Activity name. usually in VB.NET, I use: B4X: Button1.PerformClick how in B4A?
What can I do to press the button through code, without knowing EventName of a button or Activity name. usually in VB.NET, I use: B4X: Button1.PerformClick how in B4A?
DonManfred Expert Licensed User Longtime User Mar 23, 2014 #2 Put the logic from the button_click sub into a normal sub which you then just call... Instead of B4X: sub button_click ' doing a lot of stuff here end sub you can do something like B4X: sub button_click subwhodidthestuff end sub sub subwhodidthestuff ' doing a lot of stuff here end sub And if you then want to "simulate" a button click you just call the sub subwhodidthestuff Upvote 0
Put the logic from the button_click sub into a normal sub which you then just call... Instead of B4X: sub button_click ' doing a lot of stuff here end sub you can do something like B4X: sub button_click subwhodidthestuff end sub sub subwhodidthestuff ' doing a lot of stuff here end sub And if you then want to "simulate" a button click you just call the sub subwhodidthestuff
Erel B4X founder Staff member Licensed User Longtime User Mar 24, 2014 #3 You can also call button_click directly. However if you don't know the event name value then you can use JavaObject: B4X: Dim jo As JavaObject = button1 jo.RunMethod("performClick", null) Upvote 0
You can also call button_click directly. However if you don't know the event name value then you can use JavaObject: B4X: Dim jo As JavaObject = button1 jo.RunMethod("performClick", null)