2016-08-25 1 views
1

Gtk2hsでコンボボックスを処理するにはどうすればよいですか?Gtk2hsコンパイルエラーのコンボボックス

Main.hs:36:17: 
No instance for (System.Glib.UTFString.GlibString (Maybe [Char])) 
    arising from a use of ‘cellText’ 
In the first argument of ‘(:=)’, namely ‘cellText’ 
In the expression: cellText := Just txt 
In the expression: [cellText := Just txt] 

はどのように問題を解決することができます:私は(私のコード例の最後の行で発生します)このエラーを取得するコンパイル中しかし

store <- listStoreNew ["green", "yellow", "..."] 
comboElem <- comboBoxNewWithModel store 
ren <- cellRendererTextNew 
cellLayoutPackEnd comboElem ren True 
cellLayoutSetAttributes comboElem ren store 
    (\txt -> [cellText := Just txt]) 

thisページで は私が解決策を見つけましたか?事前に

おかげ

答えて

1

GlibStringMaybe Stringのインスタンスを持っているように見えません。それは一点にあるかもしれませんが、代わりにcellText := txtを使うことができます。何らかの理由でMaybe Stringを使用する必要がある場合は、インスタンスを自分で実装することができます。

+0

'cellText'のプロパティタイプは、ある時点(いくつかのGtk2HSバージョンで)' GlibString a =>多分a'から 'GlibString a => a'に変更されているでしょう。 – Cactus