chez-libs

Hex Artifact Content
Login

Artifact b054d2ebd29d0c16f61d9e6d720ab6301303e7fa:

Wiki page [(system webview)] by murphy 2018-08-26 22:24:23.
0000: 44 20 32 30 31 38 2d 30 38 2d 32 36 54 32 32 3a  D 2018-08-26T22:
0010: 32 34 3a 32 33 2e 35 34 39 0a 4c 20 28 73 79 73  24:23.549.L (sys
0020: 74 65 6d 5c 73 77 65 62 76 69 65 77 29 0a 50 20  tem\swebview).P 
0030: 63 31 61 38 31 64 65 30 34 61 63 37 39 31 36 63  c1a81de04ac7916c
0040: 38 36 32 34 36 35 65 35 36 32 64 35 30 37 32 64  862465e562d5072d
0050: 63 66 37 64 36 66 35 38 0a 55 20 6d 75 72 70 68  cf7d6f58.U murph
0060: 79 0a 57 20 32 37 37 38 0a 3c 68 31 3e 57 65 62  y.W 2778.<h1>Web
0070: 76 69 65 77 20 42 69 6e 64 69 6e 67 73 3c 2f 68  view Bindings</h
0080: 31 3e 0d 0a 0d 0a 3c 63 6f 64 65 3e 28 69 6d 70  1>....<code>(imp
0090: 6f 72 74 20 28 73 79 73 74 65 6d 20 77 65 62 76  ort (system webv
00a0: 69 65 77 29 29 3c 2f 63 6f 64 65 3e 0d 0a 0d 0a  iew))</code>....
00b0: 42 69 6e 64 69 6e 67 73 20 74 6f 20 61 20 6d 6f  Bindings to a mo
00c0: 64 69 66 69 65 64 20 76 65 72 73 69 6f 6e 20 6f  dified version o
00d0: 66 20 74 68 65 20 5b 68 74 74 70 73 3a 2f 2f 67  f the [https://g
00e0: 69 74 68 75 62 2e 63 6f 6d 2f 7a 73 65 72 67 65  ithub.com/zserge
00f0: 2f 77 65 62 76 69 65 77 7c 77 65 62 76 69 65 77  /webview|webview
0100: 5d 20 6c 69 62 72 61 72 79 2e 0d 0a 0d 0a 3c 68  ] library.....<h
0110: 32 3e 4d 61 69 6e 20 49 6e 74 65 72 66 61 63 65  2>Main Interface
0120: 3c 2f 68 32 3e 0d 0a 0d 0a 3c 68 33 3e 70 72 6f  </h2>....<h3>pro
0130: 63 65 64 75 72 65 3a 20 3c 63 6f 64 65 3e 28 77  cedure: <code>(w
0140: 65 62 76 69 65 77 20 3c 69 3e 74 69 74 6c 65 3c  ebview <i>title<
0150: 2f 69 3e 20 3c 69 3e 75 72 6c 3c 2f 69 3e 20 3c  /i> <i>url</i> <
0160: 69 3e 6f 6e 2d 65 78 74 65 72 6e 61 6c 2d 69 6e  i>on-external-in
0170: 76 6f 6b 65 3c 2f 69 3e 20 3c 69 3e 6f 70 74 69  voke</i> <i>opti
0180: 6f 6e 3c 2f 69 3e 20 2e 2e 2e 29 3c 2f 63 6f 64  on</i> ...)</cod
0190: 65 3e 3c 2f 68 33 3e 0d 0a 0d 0a 4c 61 75 6e 63  e></h3>....Launc
01a0: 68 20 61 20 77 65 62 76 69 65 77 20 77 69 74 68  h a webview with
01b0: 20 74 68 65 20 67 69 76 65 6e 20 74 69 74 6c 65   the given title
01c0: 2c 20 55 52 4c 2c 20 65 78 74 65 72 6e 61 6c 20  , URL, external 
01d0: 69 6e 76 6f 63 61 74 69 6f 6e 20 63 61 6c 6c 62  invocation callb
01e0: 61 63 6b 20 61 6e 64 20 70 6f 73 73 69 62 6c 79  ack and possibly
01f0: 20 61 64 64 69 74 69 6f 6e 61 6c 20 63 6f 6e 66   additional conf
0200: 69 67 75 72 61 74 69 6f 6e 20 6f 70 74 69 6f 6e  iguration option
0210: 73 2e 0d 0a 0d 0a 54 68 65 20 65 78 74 65 72 6e  s.....The extern
0220: 61 6c 20 69 6e 76 6f 63 61 74 69 6f 6e 20 63 61  al invocation ca
0230: 6c 6c 62 61 63 6b 20 72 65 63 65 69 76 65 73 20  llback receives 
0240: 74 77 6f 20 61 72 67 75 6d 65 6e 74 73 3a 20 54  two arguments: T
0250: 68 65 20 77 65 62 76 69 65 77 20 61 6e 64 20 61  he webview and a
0260: 20 73 74 72 69 6e 67 2e 20 54 68 65 20 73 74 72   string. The str
0270: 69 6e 67 20 61 72 67 75 6d 65 6e 74 20 69 73 20  ing argument is 
0280: 70 72 6f 76 69 64 65 64 20 62 79 20 4a 61 76 61  provided by Java
0290: 53 63 72 69 70 74 20 6f 6e 20 74 68 65 20 70 61  Script on the pa
02a0: 67 65 20 75 73 69 6e 67 20 61 20 63 61 6c 6c 20  ge using a call 
02b0: 74 6f 20 3c 74 74 3e 77 69 6e 64 6f 77 2e 65 78  to <tt>window.ex
02c0: 74 65 72 6e 61 6c 2e 69 6e 76 6f 6b 65 3c 2f 74  ternal.invoke</t
02d0: 74 3e 2e 0d 0a 0d 0a 42 6f 74 68 20 74 68 65 20  t>.....Both the 
02e0: 55 52 4c 20 61 6e 64 20 63 61 6c 6c 62 61 63 6b  URL and callback
02f0: 20 70 72 6f 63 65 64 75 72 65 20 6d 61 79 20 62   procedure may b
0300: 65 20 3c 74 74 3e 23 66 3c 2f 74 74 3e 2e 20 49  e <tt>#f</tt>. I
0310: 66 20 6e 6f 20 55 52 4c 20 69 73 20 70 61 73 73  f no URL is pass
0320: 65 64 2c 20 61 6e 20 65 6d 70 74 79 20 64 65 66  ed, an empty def
0330: 61 75 6c 74 20 70 61 67 65 20 69 73 20 75 73 65  ault page is use
0340: 64 20 74 68 61 74 20 63 61 6c 6c 73 20 3c 74 74  d that calls <tt
0350: 3e 77 69 6e 64 6f 77 2e 65 78 74 65 72 6e 61 6c  >window.external
0360: 2e 69 6e 76 6f 6b 65 28 22 6c 6f 61 64 22 29 3c  .invoke("load")<
0370: 2f 74 74 3e 20 6f 6e 63 65 20 77 68 65 6e 20 6c  /tt> once when l
0380: 6f 61 64 65 64 2e 20 49 66 20 6e 6f 20 63 61 6c  oaded. If no cal
0390: 6c 62 61 63 6b 20 70 72 6f 63 65 64 75 72 65 20  lback procedure 
03a0: 69 73 20 70 61 73 73 65 64 2c 0d 0a 20 3c 74 74  is passed,.. <tt
03b0: 3e 77 69 6e 64 6f 77 2e 65 78 74 65 72 6e 61 6c  >window.external
03c0: 2e 69 6e 76 6f 6b 65 3c 2f 74 74 3e 20 69 73 20  .invoke</tt> is 
03d0: 61 76 61 69 6c 61 62 6c 65 20 62 75 74 20 64 6f  available but do
03e0: 65 73 20 6e 6f 74 68 69 6e 67 2e 0d 0a 0d 0a 54  es nothing.....T
03f0: 68 65 20 6c 69 73 74 20 6f 66 20 61 64 64 69 74  he list of addit
0400: 69 6f 6e 61 6c 20 63 6f 6e 66 69 67 75 72 61 74  ional configurat
0410: 69 6f 6e 20 6f 70 74 69 6f 6e 73 20 6d 61 79 20  ion options may 
0420: 63 6f 6e 74 61 69 6e 20 74 68 65 20 66 6f 6c 6c  contain the foll
0430: 6f 77 69 6e 67 20 6b 65 79 73 3a 0d 0a 0d 0a 20  owing keys:.... 
0440: 20 2a 20 20 3c 74 74 3e 77 69 64 74 68 3c 2f 74   *  <tt>width</t
0450: 74 3e 20 74 6f 20 73 70 65 63 69 66 79 20 77 69  t> to specify wi
0460: 6e 64 6f 77 20 77 69 64 74 68 0d 0a 20 20 2a 20  ndow width..  * 
0470: 20 3c 74 74 3e 68 65 69 67 68 74 3c 2f 74 74 3e   <tt>height</tt>
0480: 20 74 6f 20 73 70 65 63 69 66 79 20 77 69 6e 64   to specify wind
0490: 6f 77 20 68 65 69 67 68 74 0d 0a 20 20 2a 20 20  ow height..  *  
04a0: 3c 74 74 3e 72 65 73 69 7a 61 62 6c 65 3f 3c 2f  <tt>resizable?</
04b0: 74 74 3e 20 74 6f 20 73 70 65 63 69 66 79 20 77  tt> to specify w
04c0: 68 65 74 68 65 72 20 74 68 65 20 77 69 6e 64 6f  hether the windo
04d0: 77 20 73 69 7a 65 20 6d 61 79 20 62 65 20 63 68  w size may be ch
04e0: 61 6e 67 65 64 0d 0a 20 20 2a 20 20 3c 74 74 3e  anged..  *  <tt>
04f0: 64 65 62 75 67 3f 3c 2f 74 74 3e 20 74 6f 20 73  debug?</tt> to s
0500: 70 65 63 69 66 79 20 77 68 65 74 68 65 72 20 64  pecify whether d
0510: 65 62 75 67 67 69 6e 67 20 74 6f 6f 6c 73 20 73  ebugging tools s
0520: 68 6f 75 6c 64 20 62 65 20 65 6e 61 62 6c 65 64  hould be enabled
0530: 0d 0a 0d 0a 3c 68 33 3e 70 72 6f 63 65 64 75 72  ....<h3>procedur
0540: 65 3a 20 3c 63 6f 64 65 3e 28 77 65 62 76 69 65  e: <code>(webvie
0550: 77 2d 74 65 72 6d 69 6e 61 74 65 21 20 3c 69 3e  w-terminate! <i>
0560: 77 65 62 76 69 65 77 3c 2f 69 3e 29 3c 2f 63 6f  webview</i>)</co
0570: 64 65 3e 3c 2f 68 33 3e 0d 0a 0d 0a 41 73 6b 20  de></h3>....Ask 
0580: 74 68 65 20 67 69 76 65 6e 20 77 65 62 76 69 65  the given webvie
0590: 77 20 74 6f 20 71 75 69 74 2e 0d 0a 0d 0a 3c 68  w to quit.....<h
05a0: 33 3e 70 72 6f 63 65 64 75 72 65 3a 20 3c 63 6f  3>procedure: <co
05b0: 64 65 3e 28 77 65 62 76 69 65 77 2d 74 69 74 6c  de>(webview-titl
05c0: 65 2d 73 65 74 21 20 3c 69 3e 77 65 62 76 69 65  e-set! <i>webvie
05d0: 77 3c 2f 69 3e 20 3c 69 3e 74 69 74 6c 65 3c 2f  w</i> <i>title</
05e0: 69 3e 29 3c 2f 63 6f 64 65 3e 3c 2f 68 33 3e 0d  i>)</code></h3>.
05f0: 0a 0d 0a 43 68 61 6e 67 65 20 74 68 65 20 74 69  ...Change the ti
0600: 74 6c 65 20 6f 66 20 74 68 65 20 67 69 76 65 6e  tle of the given
0610: 20 77 65 62 76 69 65 77 2e 0d 0a 0d 0a 3c 68 33   webview.....<h3
0620: 3e 70 72 6f 63 65 64 75 72 65 3a 20 3c 63 6f 64  >procedure: <cod
0630: 65 3e 28 77 65 62 76 69 65 77 2d 66 75 6c 6c 73  e>(webview-fulls
0640: 63 72 65 65 6e 2d 73 65 74 21 20 3c 69 3e 77 65  creen-set! <i>we
0650: 62 76 69 65 77 3c 2f 69 3e 20 3c 69 3e 66 75 6c  bview</i> <i>ful
0660: 6c 73 63 72 65 65 6e 3f 3c 2f 69 3e 29 3c 2f 63  lscreen?</i>)</c
0670: 6f 64 65 3e 3c 2f 68 33 3e 0d 0a 0d 0a 43 68 61  ode></h3>....Cha
0680: 6e 67 65 20 74 68 65 20 66 75 6c 6c 73 63 72 65  nge the fullscre
0690: 65 6e 20 73 74 61 74 65 20 6f 66 20 74 68 65 20  en state of the 
06a0: 67 69 76 65 6e 20 77 65 62 76 69 65 77 2e 0d 0a  given webview...
06b0: 0d 0a 3c 68 33 3e 70 72 6f 63 65 64 75 72 65 3a  ..<h3>procedure:
06c0: 20 3c 63 6f 64 65 3e 28 77 65 62 76 69 65 77 2d   <code>(webview-
06d0: 65 76 61 6c 20 3c 69 3e 77 65 62 76 69 65 77 3c  eval <i>webview<
06e0: 2f 69 3e 20 3c 69 3e 63 6f 64 65 3c 2f 69 3e 29  /i> <i>code</i>)
06f0: 3c 2f 63 6f 64 65 3e 3c 2f 68 33 3e 0d 0a 0d 0a  </code></h3>....
0700: 45 76 61 6c 75 61 74 65 20 4a 61 76 61 53 63 72  Evaluate JavaScr
0710: 69 70 74 20 63 6f 64 65 20 69 6e 20 74 68 65 20  ipt code in the 
0720: 67 69 76 65 6e 20 77 65 62 76 69 65 77 2e 0d 0a  given webview...
0730: 0d 0a 3c 68 32 3e 44 69 61 6c 6f 67 20 49 6e 74  ..<h2>Dialog Int
0740: 65 72 66 61 63 65 3c 2f 68 32 3e 0d 0a 0d 0a 3c  erface</h2>....<
0750: 68 33 3e 73 79 6e 74 61 78 3a 20 3c 63 6f 64 65  h3>syntax: <code
0760: 3e 28 64 69 61 6c 6f 67 2d 74 79 70 65 2d 66 6c  >(dialog-type-fl
0770: 61 67 20 3c 69 3e 73 79 6d 62 6f 6c 3c 2f 69 3e  ag <i>symbol</i>
0780: 29 3c 2f 63 6f 64 65 3e 3c 2f 68 33 3e 0d 0a 3c  )</code></h3>..<
0790: 68 33 3e 73 79 6e 74 61 78 3a 20 3c 63 6f 64 65  h3>syntax: <code
07a0: 3e 28 64 69 61 6c 6f 67 2d 74 79 70 65 20 3c 69  >(dialog-type <i
07b0: 3e 73 79 6d 62 6f 6c 3c 2f 69 3e 20 2e 2e 2e 29  >symbol</i> ...)
07c0: 3c 2f 63 6f 64 65 3e 3c 2f 68 33 3e 0d 0a 0d 0a  </code></h3>....
07d0: 54 68 65 20 64 69 61 6c 6f 67 20 66 6c 61 67 73  The dialog flags
07e0: 20 65 6e 75 6d 65 72 61 74 69 6f 6e 20 69 73 20   enumeration is 
07f0: 75 73 65 64 20 74 6f 20 69 6e 64 69 63 61 74 65  used to indicate
0800: 20 74 68 65 20 74 79 70 65 20 6f 66 20 64 69 61   the type of dia
0810: 6c 6f 67 20 70 72 65 73 65 6e 74 65 64 20 62 79  log presented by
0820: 20 3c 74 74 3e 77 65 62 76 69 65 77 2d 64 69 61   <tt>webview-dia
0830: 6c 6f 67 3c 2f 74 74 3e 3a 0d 0a 0d 0a 20 20 2a  log</tt>:....  *
0840: 20 20 3c 74 74 3e 6f 70 65 6e 3c 2f 74 74 3e 20    <tt>open</tt> 
0850: 73 68 6f 77 73 20 61 20 66 69 6c 65 20 6f 70 65  shows a file ope
0860: 6e 20 64 69 61 6c 6f 67 0d 0a 20 20 2a 20 20 3c  n dialog..  *  <
0870: 74 74 3e 73 61 76 65 3c 2f 74 74 3e 20 73 68 6f  tt>save</tt> sho
0880: 77 73 20 61 20 66 69 6c 65 20 73 61 76 65 20 64  ws a file save d
0890: 69 61 6c 6f 67 0d 0a 20 20 2a 20 20 3c 74 74 3e  ialog..  *  <tt>
08a0: 64 69 72 65 63 74 6f 72 79 3c 2f 74 74 3e 20 61  directory</tt> a
08b0: 6c 6c 6f 77 73 20 73 65 6c 65 63 74 69 6f 6e 20  llows selection 
08c0: 6f 66 20 61 20 64 69 72 65 63 74 6f 72 79 20 69  of a directory i
08d0: 6e 73 74 65 61 64 20 6f 66 20 61 20 66 69 6c 65  nstead of a file
08e0: 0d 0a 20 20 2a 20 20 3c 74 74 3e 69 6e 66 6f 3c  ..  *  <tt>info<
08f0: 2f 74 74 3e 20 73 68 6f 77 73 20 61 6e 20 69 6e  /tt> shows an in
0900: 66 6f 72 6d 61 74 69 6f 6e 61 6c 20 6d 65 73 73  formational mess
0910: 61 67 65 0d 0a 20 20 2a 20 20 3c 74 74 3e 77 61  age..  *  <tt>wa
0920: 72 6e 69 6e 67 3c 2f 74 74 3e 20 73 68 6f 77 73  rning</tt> shows
0930: 20 61 20 77 61 72 6e 69 6e 67 20 6d 65 73 73 61   a warning messa
0940: 67 65 0d 0a 20 20 2a 20 20 3c 74 74 3e 65 72 72  ge..  *  <tt>err
0950: 6f 72 3c 2f 74 74 3e 20 73 68 6f 77 73 20 61 6e  or</tt> shows an
0960: 20 65 72 72 6f 72 20 6d 65 73 73 61 67 65 0d 0a   error message..
0970: 0d 0a 3c 68 33 3e 70 72 6f 63 65 64 75 72 65 3a  ..<h3>procedure:
0980: 20 3c 63 6f 64 65 3e 28 77 65 62 76 69 65 77 2d   <code>(webview-
0990: 64 69 61 6c 6f 67 20 3c 69 3e 77 65 62 76 69 65  dialog <i>webvie
09a0: 77 3c 2f 69 3e 20 3c 69 3e 74 79 70 65 3c 2f 69  w</i> <i>type</i
09b0: 3e 20 3c 69 3e 74 69 74 6c 65 3c 2f 69 3e 20 3c  > <i>title</i> <
09c0: 69 3e 76 61 6c 75 65 3c 2f 69 3e 29 3c 2f 63 6f  i>value</i>)</co
09d0: 64 65 3e 3c 2f 68 33 3e 0d 0a 3c 68 33 3e 70 72  de></h3>..<h3>pr
09e0: 6f 63 65 64 75 72 65 3a 20 3c 63 6f 64 65 3e 28  ocedure: <code>(
09f0: 77 65 62 76 69 65 77 2d 64 69 61 6c 6f 67 20 3c  webview-dialog <
0a00: 69 3e 77 65 62 76 69 65 77 3c 2f 69 3e 20 3c 69  i>webview</i> <i
0a10: 3e 74 79 70 65 3c 2f 69 3e 20 3c 69 3e 74 69 74  >type</i> <i>tit
0a20: 6c 65 3c 2f 69 3e 29 3c 2f 63 6f 64 65 3e 3c 2f  le</i>)</code></
0a30: 68 33 3e 0d 0a 0d 0a 50 72 65 73 65 6e 74 20 61  h3>....Present a
0a40: 20 64 69 61 6c 6f 67 20 61 73 20 61 20 6d 6f 64   dialog as a mod
0a50: 61 6c 20 63 68 69 6c 64 20 6f 66 20 74 68 65 20  al child of the 
0a60: 67 69 76 65 6e 20 77 65 62 76 69 65 77 2e 20 52  given webview. R
0a70: 65 74 75 72 6e 73 20 74 68 65 20 64 61 74 61 20  eturns the data 
0a80: 73 65 6c 65 63 74 65 64 20 69 6e 20 74 68 65 20  selected in the 
0a90: 64 69 61 6c 6f 67 20 6f 72 20 3c 74 74 3e 23 66  dialog or <tt>#f
0aa0: 3c 2f 74 74 3e 2e 0d 0a 0d 0a 3c 68 32 3e 4d 69  </tt>.....<h2>Mi
0ab0: 73 63 65 6c 6c 61 6e 65 6f 75 73 3c 2f 68 32 3e  scellaneous</h2>
0ac0: 0d 0a 0d 0a 3c 68 33 3e 70 72 6f 63 65 64 75 72  ....<h3>procedur
0ad0: 65 3a 20 3c 63 6f 64 65 3e 28 6c 6f 67 66 20 3c  e: <code>(logf <
0ae0: 69 3e 66 6d 74 3c 2f 69 3e 20 3c 69 3e 61 72 67  i>fmt</i> <i>arg
0af0: 3c 2f 69 3e 20 2e 2e 2e 29 3c 2f 63 6f 64 65 3e  </i> ...)</code>
0b00: 3c 2f 68 33 3e 0d 0a 0d 0a 4c 6f 67 20 61 20 66  </h3>....Log a f
0b10: 6f 72 6d 61 74 74 65 64 20 6d 65 73 73 61 67 65  ormatted message
0b20: 20 74 6f 20 73 6f 6d 65 20 73 79 73 74 65 6d 2d   to some system-
0b30: 73 70 65 63 69 66 69 63 20 63 68 61 6e 6e 65 6c  specific channel
0b40: 2e 0d 0a 0a 5a 20 39 33 66 61 36 33 35 34 35 38  ....Z 93fa635458
0b50: 37 65 34 63 35 37 63 32 34 66 31 64 38 30 65 35  7e4c57c24f1d80e5
0b60: 37 37 64 62 32 38 0a                             77db28.