B4A Tutorial [B4X] Resumable subs that return values (ResumableSub) - Erel    Aug 25, 2020   (40 reactions)   tags: wait, Comm, Code, B4X, Dialog ResumableSub, Wait For Remember that that a call to Sleep or Wait For in a resumable sub causes the code flow to return to.... Solution Resumable subs can return a new type named ResumableSub. Other subs can use this value to...) End Sub Sub Sum(a As Int, b As Int) As ResumableSub Sleep(100) Log(a + b) Return a + b End... Button1_Click Dim rs As ResumableSub = Sum(1, 2) Wait For(rs) Complete (Result As Int) Log... As ResumableSub to the resumable sub signature. 2. Call Return with the value you like to return. 3... B4J Tutorial [B4X] Resumable Subs - Sleep / Wait For - Erel    Feb 22, 2018   (49 reactions)   tags: Reference, Comm, download, Resumable Subs, Code, Wait For New video tutorial: 255570732 Resumable subs is a new feature added in B4J v5.50 / B4i v4.00... of stackless coroutines.) The special feature of resumable subs is that they can be paused, without... or Wait For is a resumable subs. The IDE shows an indicator next to the sub declaration: https://www...) Sleep(1000) Log(2) The sub will be paused for 1000 milliseconds and then be resumed. You can call... As demonstrated in the following example, each call to a resumable sub creates a different instance which... B4J Code Snippet Resumable Subs (wait for / sleep) in server handlers - Erel    Feb 16, 2020   (15 reactions) Resumable subs can only work when there is a message queue. By default, server handlers end when the Handle sub is completed. They do not create a message loop. If you want to wait for an event then... j.Release StopMessageLoop '<---- End Sub The Handle sub cannot be a resumable sub... a page and returns it as the response: Sub Handle(req As ServletRequest, resp As ServletResponse) Download(resp) StartMessageLoop '<--- End Sub Sub Download (resp As ServletResponse... B4A Tutorial [B4X] Resumable subs and the index pattern - Erel    Nov 24, 2019   (27 reactions) resumable subs are used. It is a simple solution to avoid race conditions and unexpected states. The resumable subs code like all other standard B4X code, is executed by the main thread. Still, with resumable subs you can easily have multiple instances of the same sub running almost at the same time... End Sub Whenever the sub instance is resumed after Sleep or Wait For we check whether MyIndex... it reaches the desired value. Sub B4XSeekBar1_ValueChanged (Value As Int) Do Until Label1.Text... B4A Question Resumable Subs - order of execution - luke2012    May 29, 2021 Hi all, within a initialize of a class I run three resumable subs: "Download1"... this method if needed. Public Sub Initialize Download1 'Resumable Sub1 Download2 'Resumable Sub2 Download3 'Resumable Sub3 End Sub Sub Download1 Wait For (GetIDs (ID1, user, psw)) Complete (result1 As List) 'code... End Sub Sub Download2 Wait For (GetIDs (ID2, user, psw)) Complete (result2As List) 'code... End Sub Sub Download3 Wait For (GetIDs... B4J Question [BANanoServer] [SOLVED] Request assistance with jRDC2 error with ResumableSub - Mashiane    Jan 31, 2021 it because an jRDC2 call is a ResumableSub. JRDC2OnBrowser calls the JRDC2OnServer call. Whilst the sql...) As ResumableSub Log("ServerIndex.JRDC2OnServer...") odbc.Initialize(payload) odbc... Line 41203 has this kind of code. // Public Sub Initialize _B.initialize=function() { // If ws....onconnecting = function(e) {_B.websocket_onconnecting(e);}}; // End If } // End Sub }; I am calling this BROWSERIndex call 'process records to the MySQL Database, receive from router Sub... B4J Tutorial [B4X] How Resumable Subs work - agraham    Jan 30, 2019   (27 reactions) This document is intended to add a little understanding as to how Resumable Subs actually work... an appropriate Sub when an event occurs. The Resumable Sub mechanism allows this "do, wait, then... code for a Resumable sub. The B4X compiler generates a class for each Resumable Sub. That class has instance fields that carry the local variable values for the Sub, a resume() method that contains the code for the Sub and a state variable that determines which section of the code in the resume... B4A Code Snippet Voice Recognition with Resumable Subs - Erel    Aug 17, 2017   (24 reactions)   tags: Voice, Resuma, Recognition, Voice recognition The ability of resumable subs to return values (added in B4A v7.3) makes it very simple to add voice recognition to your app. Code: Private Sub RecognizeVoice As ResumableSub vr.Listen Wait... Return Texts.Get(0) End If Return "" End Sub You can call it like this: Wait For (RecognizeVoice) Complete (Result As String) Example: Sub Activity_Click Wait For (RecognizeVoice... End If End Sub Example is attached.... B4A Question Resumable Sub that returns 2 values - Alessandro71    Jan 3, 2023 How can you write a Resumable Sub that returns 2 values, just like ExecQueryAsync? I always see Resumable Subs that returns just one value Dim SenderFilter As Object = sql.ExecQueryAsync("SQL", "SELECT * FROM table1", Null) Wait For (SenderFilter) SQL_QueryComplete (Success As Boolean, rs As ResultSet)... B4J Question ABPlugin with ResumableSub - Blueforcer    Nov 22, 2018   (1 reaction) ) JobDone(j As HttpJob) to wait for the response, the Run sub has to be a ResumableSub to parse the response. public Sub Run(Tag As String, Params As Map) As ResumableSub Select Case Tag... application i try to get the map with Dim rs As ResumableSub = plugin.RunPlugin("test"...: anywheresoftware.b4a.keywords.Common$ResumableSubWrapper cannot be cast to anywheresoftware.b4a.BA$ResumableSub how can i make this work?... Page: 1   2   3   4   5   6   7   |