You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First of all, as it is my first message here, thanks for such a nice GUI library that respects Haskell! Having a blast using it.
To the issue I found then. I tried to send a message to a widget that is inside an alert and it doesn't work. When the message is sent, there's a log stating that Key WidgetKey "foo" not found for Message. Moving the message target outside the alert and in a custom hidden widget is working properly.
Here is a little demo of the issue. The vscroll within the "custom" fake dialog is properly reset on close, while the vscroll within the alert is not reset and not found (the error message quoted earlier is printed in the console).
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TemplateHaskell #-}
moduleMainwhereimportControl.LensimportData.MaybeimportData.TextimportMonomerimportTextShowimportqualifiedMonomer.LensasLdataAppModel=AppModel{_showAlert::Bool
, _showCustom::Bool
, _text::Text}deriving (Eq, Show)
dataAppEvent=Init
| ShowAlert
| ShowCustom
| CloseAlert
| CloseCustomderiving (Eq, Show)
makeLenses 'AppModel
buildUI::WidgetEnvAppModelAppEvent->AppModel->WidgetNodeAppModelAppEvent
buildUI wenv model = widgetTree
where
alertWithScroll =
alert
CloseAlert
(vscroll (textArea_ text [readOnly] `styleBasic` [maxHeight 200]) `nodeKey`"alertScroll")
customContent =
box
( vstack
[ box (vscroll (textArea_ text [readOnly]) `nodeKey`"customScroll") `styleBasic` [maxHeight 200]
, button "close"CloseCustom
]
)
`styleBasic` [bgColor darkGray]
widgetTree =
zstack
[ box $
vstack
[ button "Open Alert"ShowAlert
, button "Open Custom"ShowCustom
]
, alertWithScroll `nodeVisible` (model ^. showAlert)
, customContent `nodeVisible` (model ^. showCustom)
]
`styleBasic` [padding 10]
handleEvent::WidgetEnvAppModelAppEvent->WidgetNodeAppModelAppEvent->AppModel->AppEvent->
[AppEventResponseAppModelAppEvent]
handleEvent wenv node model evt =case evt ofInit->[]ShowAlert-> [Model$ model & showAlert .~True]
ShowCustom-> [Model$ model & showCustom .~True]
CloseAlert->
[ Model$ model & showAlert .~False
, Message"alertScroll"ScrollReset
]
CloseCustom->
[ Model$ model & showCustom .~False
, Message"customScroll"ScrollReset
]
main::IO()
main =do
startApp model handleEvent buildUI config
where
config =
[ appWindowTitle "Alert NodeKey"
, appWindowIcon "./assets/images/icon.png"
, appTheme darkTheme
, appFontDef "Regular""./assets/fonts/Roboto-Regular.ttf"
, appInitEvent Init
]
model =AppModelFalseFalse longText
longText::Text
longText ="Curabitur ut neque ac ligula tristique commodo eget eget nulla.\n\ \Integer mattis nisi sed venenatis dictum.\n\ \Praesent et sapien quis lorem lobortis iaculis lobortis sit amet enim.\n\ \Donec porta libero in efficitur lacinia.\n\ \Donec non nisl congue, ultrices lorem faucibus, feugiat augue.\n\ \Proin in purus sed orci convallis pharetra.\n\ \Suspendisse cursus nisi sed risus pharetra semper.\n\ \Pellentesque nec elit at urna varius rutrum eu nec felis.\n\ \Curabitur tincidunt ex tempus massa viverra pulvinar.\n\ \Suspendisse sollicitudin nunc vitae velit mollis feugiat.\n\ \Donec sit amet nisi a lorem laoreet consectetur vel et lorem.\n\ \Fusce et tellus efficitur, tempor velit non, accumsan nisi.\n\ \Nunc tincidunt magna a dolor venenatis hendrerit.\n\ \Nunc id risus eu nisi consectetur suscipit.\n\ \Suspendisse eu lectus eget risus scelerisque dignissim ut quis leo.\n\ \Cras lacinia est sed arcu placerat, non mattis augue ultrices.\n\ \Duis dapibus urna nec massa faucibus, at maximus augue laoreet.\n\ \Morbi et nibh molestie mauris mattis efficitur sit amet id metus.\n\ \Sed id lectus scelerisque, vehicula mauris eget, dapibus sem.\n\ \Nam vel leo aliquet nibh faucibus ornare."
Am I missing something or is this a bug?
The text was updated successfully, but these errors were encountered:
Hi!
First of all, as it is my first message here, thanks for such a nice GUI library that respects Haskell! Having a blast using it.
To the issue I found then. I tried to send a message to a widget that is inside an alert and it doesn't work. When the message is sent, there's a log stating that
Key WidgetKey "foo" not found for Message
. Moving the message target outside the alert and in a custom hidden widget is working properly.Here is a little demo of the issue. The vscroll within the "custom" fake dialog is properly reset on close, while the vscroll within the alert is not reset and not found (the error message quoted earlier is printed in the console).
Am I missing something or is this a bug?
The text was updated successfully, but these errors were encountered: