# HG changeset patch # User Adam Chlipala # Date 1253027900 14400 # Node ID e2be476673f224a62c7449e5ec0313d424496aa9 # Parent 38a376dc7401f6ac355c3fe39de5c4c0be585916 Selection working, but switching it on isn't diff -r 38a376dc7401 -r e2be476673f2 demo/more/dbgrid.urs --- a/demo/more/dbgrid.urs Tue Sep 15 10:50:49 2009 -0400 +++ b/demo/more/dbgrid.urs Tue Sep 15 11:18:20 2009 -0400 @@ -110,4 +110,7 @@ val grid : transaction grid val sync : grid -> transaction unit val render : grid -> xbody + + val showSelection : grid -> source bool + val selection : grid -> signal (list ($(M.key ++ M.row))) end diff -r 38a376dc7401 -r e2be476673f2 demo/more/grid.ur --- a/demo/more/grid.ur Tue Sep 15 10:50:49 2009 -0400 +++ b/demo/more/grid.ur Tue Sep 15 11:18:20 2009 -0400 @@ -48,18 +48,24 @@ [_] M.folder cols M.cols) (@@Folder.mp [_] [_] M.folder) + type grid = {Cols : $(map fst M.cols), + Rows : Dlist.dlist {Row : source M.row, + Cols : source ($(map snd M.cols)), + Updating : source bool, + Selected : source bool}, + Selection : source bool} + fun addRow cols rows row = rowS <- source row; cols <- makeAll cols row; colsS <- source cols; ud <- source False; + sd <- source False; Monad.ignore (Dlist.append rows {Row = rowS, Cols = colsS, - Updating = ud}) + Updating = ud, + Selected = sd}) - type grid = {Cols : $(map fst M.cols), - Rows : Dlist.dlist {Row : source M.row, Cols : source ($(map snd M.cols)), Updating : source bool}} - val createMetas = Monad.mapR [colMeta M.row] [fst] (fn [nm :: Name] [p :: (Type * Type)] meta => meta.Initialize) [_] M.folder M.cols @@ -67,9 +73,10 @@ val grid = cols <- createMetas; rows <- Dlist.create; - return {Cols = cols, Rows = rows} + sel <- source False; + return {Cols = cols, Rows = rows, Selection = sel} - fun sync {Cols = cols, Rows = rows} = + fun sync {Cols = cols, Rows = rows, ...} = Dlist.clear rows; init <- rpc M.list; List.app (addRow cols rows) init @@ -85,7 +92,7 @@ [_] M.folder grid.Cols M.cols} - {Dlist.render (fn {Row = rowS, Cols = colsS, Updating = ud} pos => + {Dlist.render (fn {Row = rowS, Cols = colsS, Updating = ud, Selected = sd} pos => let val delete = Dlist.delete pos; @@ -135,6 +142,14 @@ in + + else + No)}/> + + +