Posted By

keigoi on 07/27/09


Tagged

haskell textBox wxHaskell singleline windowGetWindowStyleFlag


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

keigoi


Single line textbox in wxHaskell


 / Published in: Haskell
 

This snippet shows you how to create a single-line text box, or how to use windowGetWindowStyleFlag. Press enter to put text in the textbox into the console.

  1. import EnableGUI -- from http://wxhaskell.sourceforge.net/download/EnableGUI.hs
  2.  
  3. import Graphics.UI.WXCore
  4. import Graphics.UI.WX hiding
  5. import Data.Bits ((.&.), complement)
  6.  
  7. textCtrlSetSingleLine ctrl = do
  8. style <- windowGetWindowStyleFlag ctrl
  9. windowSetWindowStyleFlag ctrl (style .&. (complement wxTE_MULTILINE))
  10.  
  11. gui
  12. = do f <- frame [text := "single line textbox sample"]
  13. input <- textCtrlRich f [bgcolor := black, textColor := white, font := fontFixed{ _fontSize = 12 }]
  14. set f [layout := column 1 [hfill (widget input)]]
  15. set input [processEnter := True]
  16. textCtrlSetSingleLine input
  17. set input [on command := onEnter input]
  18. return ()
  19. where
  20. onEnter input
  21. = do
  22. txt <- get input text
  23. set input [text := ""]
  24.  
  25. main = enableGUI >> start gui

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: keigoi on August 1, 2009

later on, I found textentry control which provides single line textbox in wxHaskell.

You need to login to post a comment.