From feeley@iro.umontreal.ca Sat Dec 7 13:16:59 2013 From: Marc Feeley To: gambit-list@iro.umontreal.ca Subject: Re: [gambit-list] webView documentation Date: Sat, 07 Dec 2013 13:16:34 -0500 Message-ID: In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============3049332773157414620==" --===============3049332773157414620== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable On Dec 7, 2013, at 9:36 AM, Fuchs Ira wrote: > Beginner Q: I am searching for any documentation for (set-webView-content) = or (show-webView). They don't appear in the Gambit manual so I presume they a= re specific to implementations such as the one for Android but where are such= OS specific procedures documented? Gambit REPL for iOS and Gambit for Android are ports of Gambit that add funct= ionality to the base Gambit system. The functions added by these ports are n= ot documented in the Gambit manual. I'm afraid you'll have to read the sourc= es to figure out the details. I can explain a few of the most useful functions related to webViews. Gambit= REPL internally manages 4 webViews, numbered 0 to 3. The webView for the sp= lash screen is number 0. The webView for the editor is number 3. The call (intf#show-view n) will switch the screen to the webView number n. So (intf#show-view 0) switch= es to the splash screen. The content of a webView can be changed by calling intf#set-view-content. Th= e first parameter is the number of the webView to change. The second paramet= er is a string containing the new HTML content of the page. So the call (intf#set-view-content 0 "
hello
") will show a page containing a centered "hello". Interaction between the user and a webView is done by installing a handler th= at intercepts changes to the webView "location". Then each possible event ca= n be encoded by a specific location, for example "event:ok" to indicate that = an "ok" button was pressed. So a webView set with (intf#set-view-content 0 "click this") will generate a change of location to "event:this" when the "this" link is cl= icked. This change of location is detected by the handler installed with (intf#set-event-handler (lambda (old-event-handler) (lambda (event) (cond ((equal? event "event:this") (handle-click-this)) (else (old-event-handler event)))))) If the event needs to send extra information, this must be encoded in the str= ing identifying the event. I hope this helps you understand. For specific examples, see the program.scm= file in contrib/GambitREPL . Marc --===============3049332773157414620==--