Permalink
Browse files

Bugfix 1224727: textColor attribute does not appear to work correctly.

Ignore-this: cecaa0a6cb8e6cefb685aeefb279e85f

darcs-hash:20100521113227-75908-89ddbb45ebe4c8e528a819a3b25400c5dafa18e4.gz
  • Loading branch information...
1 parent 0af769b commit d0f2be4418e68f7f78a3b192480dbf7cae1b0f67 @jodonoghue committed May 21, 2010
Showing with 15 additions and 11 deletions.
  1. +11 −6 bugs/TextColor.hs
  2. +4 −5 wx/src/Graphics/UI/WX/Controls.hs
View
@@ -1,17 +1,22 @@
import Graphics.UI.WX
bugtext = unlines
- [ "Bug: the text in all these entry fields should be red,"
- , "it is black in the first two" ]
+ [ "Bug: the text in all these entry fields should be coloured,"
+ , "coloured according to the text." ]
main = start $
do f <- frame []
- e1 <- entry f [text := "hello", textColor := red]
- t1 <- textCtrlRich f [text := "bad", textColor := red]
+ e1 <- entry f [textColor := red, text := "should be red"]
+ t1 <- textCtrlRich f [textColor := red, text := "should be red"]
t2 <- textCtrlRich f [textColor := red]
- set t2 [text := "good"]
+ set t2 [text := "should be red"]
+ t3 <- textCtrlRich f []
+ set t3 [textColor := red, text := "should be red"]
+ t4 <- textCtrlRich f [text := "should be black!", textColor := red]
set f [ layout := column 4 [ label bugtext
, widget e1
, widget t1
- , widget t2 ]]
+ , widget t2
+ , widget t3
+ , widget t4 ]]
@@ -318,7 +318,7 @@ instance Able (TextCtrl a) where
--
entry :: Window a -> [Prop (TextCtrl ())] -> IO (TextCtrl ())
entry parent props
- = textCtrlEx parent 0 props
+ = textCtrlEx parent wxTE_RICH props
-- | Create a single-line text entry control. Note: 'alignment' has to
-- be set at creation time (or the entry has default alignment (=left) ).
@@ -328,7 +328,7 @@ entry parent props
--
textEntry :: Window a -> [Prop (TextCtrl ())] -> IO (TextCtrl ())
textEntry parent props
- = textCtrlEx parent 0 props
+ = textCtrlEx parent wxTE_RICH props
-- | Create a multi-line text control. Note: the 'wrap' and 'alignment'
-- have to be set at creation time or the default to 'WrapNone' and 'AlignLeft' respectively.
@@ -338,7 +338,7 @@ textEntry parent props
--
textCtrl :: Window a -> [Prop (TextCtrl ())] -> IO (TextCtrl ())
textCtrl parent props
- = textCtrlEx parent wxTE_MULTILINE props
+ = textCtrlEx parent (wxTE_MULTILINE .+. wxTE_RICH) props
-- | Create a multi-line text rich-text control with a certain wrap mode
@@ -362,10 +362,9 @@ textCtrlEx :: Window a -> Style -> [Prop (TextCtrl ())] -> IO (TextCtrl ())
textCtrlEx parent stl props
= feed2 props stl $
initialWindow $ \id rect ->
- initialText $ \txt ->
initialWrap $
initialAlignment $ \props flags ->
- do e <- textCtrlCreate parent id txt rect flags
+ do e <- textCtrlCreate parent id "" rect flags
set e props
return e

0 comments on commit d0f2be4

Please sign in to comment.