2014-02-06 24 views
4

我剛開始使用gtk2hs(hackage上的gtk3),並遇到了與comboBoxes有關的一些問題。 我不能讓一個簡單的comboBoxNewText顯示它的字符串。我已經評論了我的應用程序中不需要的所有內容,所以我只是爲實際框設計了一個基本框架。ComboBox不顯示任何字符串

import Graphics.UI.Gtk 
import Control.Monad.IO.Class 

main = do 
    initGUI 
    window <- windowNew 
    set window [windowTitle := "Table", containerBorderWidth := 20, 
       windowDefaultWidth := 800, windowDefaultHeight := 600] 

    table <- tableNew 10 10 True 
    containerAdd window table 
    lbox <- hBoxNew False 0 
    rbox <- hBoxNew False 0 
    tableAttachDefaults table lbox 0 3 0 10 
    tableAttachDefaults table rbox 3 10 0 10 

    cb <- comboBoxNewText 
    comboBoxAppendText cb "test" 
    boxPackStart lbox cb PackGrow 10 

    on window deleteEvent $ liftIO mainQuit >> return False 
    widgetShowAll window 
    mainGUI 

我錯過了什麼嗎? gtk3在hackage上被標記爲不穩定的iirc,這可能是一個錯誤嗎?或者我只是在做一些不正確的事情? 添加comboBoxSetActive cb 0也沒有幫助。爲了澄清,當我運行該程序時出現實際的組合框,但它不包含任何字符串/爲空。 evernote image

+0

是組合框完全空的,或者它包含空白項的是否正確? – Carl

+0

它完全是空的,點擊時它顯示一個比框更寬的窗口,只有幾個像素高。 – instantepiphany

+1

這個確切的代碼在與gtk而不是gtk3鏈接時有效。所以看起來好像gtk3包中可能存在一個錯誤。 –

回答

相關問題