Commit 9f76defd authored by James Brock's avatar James Brock

replaceOutput runs without flickering the GUI

Also export `OutputMsg` constructors so that users can call
`setField` on an `OutputWidget` to write their own `replaceOutput`
functions.
parent dfcbe59c
...@@ -77,4 +77,6 @@ import IHaskell.Display.Widgets.Common as X ...@@ -77,4 +77,6 @@ import IHaskell.Display.Widgets.Common as X
import IHaskell.Display.Widgets.Types as X (setField, getField, properties, triggerDisplay, import IHaskell.Display.Widgets.Types as X (setField, getField, properties, triggerDisplay,
triggerChange, triggerClick, triggerSelection, triggerChange, triggerClick, triggerSelection,
triggerSubmit, ChildWidget(..), StyleWidget(..), triggerSubmit, ChildWidget(..), StyleWidget(..),
WidgetFieldPair(..), Date(..), unlink, JSONByteString(..)) WidgetFieldPair(..), Date(..), unlink,
JSONByteString(..), OutputMsg(..))
...@@ -107,8 +107,8 @@ clearOutput_ widget = widgetClearOutput True >> clearOutput' widget ...@@ -107,8 +107,8 @@ clearOutput_ widget = widgetClearOutput True >> clearOutput' widget
-- | Replace the currently displayed output for output widget -- | Replace the currently displayed output for output widget
replaceOutput :: IHaskellDisplay a => OutputWidget -> a -> IO () replaceOutput :: IHaskellDisplay a => OutputWidget -> a -> IO ()
replaceOutput widget d = do replaceOutput widget d = do
clearOutput_ widget disp <- display d
appendDisplay widget d setField widget Outputs [OutputData disp]
instance IHaskellWidget OutputWidget where instance IHaskellWidget OutputWidget where
getCommUUID = uuid getCommUUID = uuid
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment