📄 mainsimplelistbox.hs
字号:
{- This program displays a list box (initially empty). The user adds new items by typing a line into the keyboard, and deletes items by selecting them in the list box. -}module Main whereimport Control.Concurrentimport Computationimport Eventsimport Focusimport DialogWinimport SimpleListBoximport HTkhandleSelections :: SimpleListBox String -> Event [SimpleListBoxItem String] -> Event ()handleSelections simpleListBox event = do selections <- event always (mapM (deleteItem simpleListBox) selections ) handleSelections simpleListBox eventhandleAdditions :: SimpleListBox String -> IO ()handleAdditions simpleListBox = do nextItem <- getLine addItemAtEnd simpleListBox nextItem handleAdditions simpleListBoxmain = do main <- initHTk [text "Simple List Box"] simpleListBox <- newSimpleListBox main id [size (10,15)] (event,terminator) <- bindSelection simpleListBox spawnEvent (handleSelections simpleListBox event) pack simpleListBox [] handleAdditions simpleListBox
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -