Hi Miguel, On Fri, 23 Nov 2007 22:14:22 +0900, Miguel Vilaça <[EMAIL PROTECTED]> wrote: > The problem is that both textCtrlAppendText and textCtrlWriteText always > write the new pieces of text in the end of the previous text and I need > to insert the text in the place where the TextCtrl cursor is.
I think you misunderstand textCtrlAppendText behavior. textCtrlAppendText appends text at the end of the text control, and then sets insertion position at the end of text control. http://www.wxwidgets.org/manuals/2.6.4/wx_wxtextctrl.html#wxtextctrlappendtext This behavior is same as textCtrlWriteText with textCtrlSetInsertionPointEnd. http://www.wxwidgets.org/manuals/2.6.4/wx_wxtextctrl.html#wxtextctrlwritetext > I also tried > textCtrlSetInsertionPoint "DUMMY" 0 > but that didn't change any behavior. It seems this function do nothing. So you must use textCtrlWriteText with textCtrlSetInsertionPoint. I wrote sample program for this problem. Please test and understand these functions behavior. import Graphics.UI.WX import Graphics.UI.WXCore main = start $ do f <- frame [ text := "Position Test"] p <- panel f [] t <- textCtrl p [ text := "dummy" , clientSize := sz 300 300] b1 <- button p [ text:= "writText" , on command := writeText t] b2 <- button p [ text:= "AppendText" , on command := appendText t] set f [ layout := container p $ column 5 [ fill $ widget t , hfill $ widget b1 , hfill $ widget b2] , clientSize := sz 400 400] where writeText t = do pos <- textCtrlGetInsertionPoint t textCtrlSetInsertionPoint t pos -- textCtrlSetInsertionPointEnd t textCtrlWriteText t "writeText!" appendText t = do pos <- textCtrlGetInsertionPoint t -- textCtrlGetInsertionPoint can get insertion point. -- print pos -- pos <- textCtrlXYToPosition t $ pt 0 0 textCtrlSetInsertionPoint t pos textCtrlAppendText t "AppendText!" Best Regards, -- shelarcy <shelarcy hotmail.co.jp> http://page.freett.com/shelarcy/ ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ wxhaskell-users mailing list wxhaskell-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wxhaskell-users