diff options
author | Adam Chlipala <adam@chlipala.net> | 2012-07-21 10:12:35 -0400 |
---|---|---|
committer | Adam Chlipala <adam@chlipala.net> | 2012-07-21 10:12:35 -0400 |
commit | da2141fbf28e6173f587ee146acc8f78b7ea8e0d (patch) | |
tree | 69937e8dd046f5e3b3ea38f66061cdc8310351bc /demo/more | |
parent | 3e838a5bf95222adb9add226aa3732c3c28633bc (diff) |
Update demo code for key/mouse handler change
Diffstat (limited to 'demo/more')
-rw-r--r-- | demo/more/dragList.ur | 20 | ||||
-rw-r--r-- | demo/more/grid.ur | 22 | ||||
-rw-r--r-- | demo/more/versioned1.ur | 38 |
3 files changed, 40 insertions, 40 deletions
diff --git a/demo/more/dragList.ur b/demo/more/dragList.ur index c4e9b69a..df4fc4fc 100644 --- a/demo/more/dragList.ur +++ b/demo/more/dragList.ur @@ -5,16 +5,16 @@ fun draggableList title items = <h2>Great {[title]}</h2> <ul> {List.mapX (fn itemSource => <xml> - <li onmousedown={set draggingItem (Some itemSource)} - onmouseup={set draggingItem None} - onmouseover={di <- get draggingItem; - case di of - None => return () - | Some di => original <- get di; - movedOver <- get itemSource; - set di movedOver; - set itemSource original; - set draggingItem (Some itemSource)}> + <li onmousedown={fn _ => set draggingItem (Some itemSource)} + onmouseup={fn _ => set draggingItem None} + onmouseover={fn _ => di <- get draggingItem; + case di of + None => return () + | Some di => original <- get di; + movedOver <- get itemSource; + set di movedOver; + set itemSource original; + set draggingItem (Some itemSource)}> <dyn signal={Monad.mp cdata (signal itemSource)}/> </li></xml>) itemSources} </ul> diff --git a/demo/more/grid.ur b/demo/more/grid.ur index a281bab7..9691442c 100644 --- a/demo/more/grid.ur +++ b/demo/more/grid.ur @@ -124,7 +124,7 @@ functor Make(M : sig fun render (grid : grid) = <xml> <table class={tabl}> <tr class={tr}> - <th/> <th/> <th><button value="No sort" onclick={set grid.Sort None}/></th> + <th/> <th/> <th><button value="No sort" onclick={fn _ => set grid.Sort None}/></th> {@mapX2 [fst3] [colMeta M.row] [tr] (fn [nm :: Name] [p :: (Type * Type * Type)] [rest :: {(Type * Type * Type)}] [[nm] ~ rest] data (meta : colMeta M.row p) => @@ -132,7 +132,7 @@ functor Make(M : sig {case (meta.Handlers data).Sort of None => txt (meta.Handlers data).Header | sort => <xml><button value={(meta.Handlers data).Header} - onclick={set grid.Sort sort}/></xml>} + onclick={fn _ => set grid.Sort sort}/></xml>} </th></xml>) M.folder grid.Cols M.cols} </tr> @@ -197,16 +197,16 @@ functor Make(M : sig <td> <dyn signal={b <- signal ud; return (if b then - <xml><button value="Save" onclick={save}/></xml> + <xml><button value="Save" onclick={fn _ => save}/></xml> else - <xml><button value="Update" onclick={update}/></xml>)}/> + <xml><button value="Update" onclick={fn _ => update}/></xml>)}/> </td> <td><dyn signal={b <- signal ud; return (if b then - <xml><button value="Cancel" onclick={cancel}/></xml> + <xml><button value="Cancel" onclick={fn _ => cancel}/></xml> else - <xml><button value="Delete" onclick={delete}/></xml>)}/> + <xml><button value="Delete" onclick={fn _ => delete}/></xml>)}/> </td> <dyn signal={cols <- signal colsS; @@ -302,8 +302,8 @@ functor Make(M : sig else <xml> <button value={show (n + 1)} - onclick={set grid.Position - (n * plen) + onclick={fn _ => set grid.Position + (n * plen) }/></xml>)}/> {if (n + 1) * plen >= avail then <xml/> else <xml>|</xml>} {pages (n + 1)} @@ -313,9 +313,9 @@ functor Make(M : sig end)}/> </xml>} - <button value="New row" onclick={row <- rpc M.new; - addRow grid.Cols grid.Rows row}/> - <button value="Refresh" onclick={sync grid}/> + <button value="New row" onclick={fn _ => row <- rpc M.new; + addRow grid.Cols grid.Rows row}/> + <button value="Refresh" onclick={fn _ => sync grid}/> </xml> fun showSelection grid = grid.Selection diff --git a/demo/more/versioned1.ur b/demo/more/versioned1.ur index 592af3cf..b5b23fb7 100644 --- a/demo/more/versioned1.ur +++ b/demo/more/versioned1.ur @@ -43,17 +43,17 @@ fun main () = {[kr.Key]}: <ctextbox source={kr.Nam}/> <ctextbox size={5} source={kr.ShoeSize}/> - <button value="Latest" onclick={ro <- rpc (current {Id = kr.Key}); - case ro of - None => alert "Can't get it!" - | Some r => - set kr.Nam r.Nam; - set kr.ShoeSize (show r.ShoeSize)}/> - <button value="Update" onclick={name <- get kr.Nam; - shoeSize <- get kr.ShoeSize; - rpc (update {Id = kr.Key, - Nam = name, - ShoeSize = readError shoeSize}) + <button value="Latest" onclick={fn _ => ro <- rpc (current {Id = kr.Key}); + case ro of + None => alert "Can't get it!" + | Some r => + set kr.Nam r.Nam; + set kr.ShoeSize (show r.ShoeSize)}/> + <button value="Update" onclick={fn _ => name <- get kr.Nam; + shoeSize <- get kr.ShoeSize; + rpc (update {Id = kr.Key, + Nam = name, + ShoeSize = readError shoeSize}) }/> </div></xml>) ks)}/> @@ -63,15 +63,15 @@ fun main () = <tr><th>Id:</th> <td><ctextbox size={5} source={id}/></td></tr> <tr><th>Name:</th> <td><ctextbox source={name}/></td></tr> <tr><th>Shoe size:</th> <td><ctextbox size={5} source={shoeSize}/></td></tr> - <tr><th><button value="Add" onclick={id <- get id; - name <- get name; - shoeSize <- get shoeSize; - rpc (insert {Id = readError id, Nam = name, - ShoeSize = readError shoeSize}); + <tr><th><button value="Add" onclick={fn _ => id <- get id; + name <- get name; + shoeSize <- get shoeSize; + rpc (insert {Id = readError id, Nam = name, + ShoeSize = readError shoeSize}); - cur <- get ks; - kr <- expandKey (readError id); - set ks (kr :: cur)}/></th></tr> + cur <- get ks; + kr <- expandKey (readError id); + set ks (kr :: cur)}/></th></tr> </table> <h2>Archive</h2> |