mainsimplelistbox.hs
来自「HTK系列的」· HS 代码 · 共 43 行
HS
43 行
{- 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 + =
减小字号Ctrl + -
显示快捷键?