2

我的问题让我很困惑,因为它只发生在 Windows 上(我正在使用 XP 进行测试)。这一切都在 Linux 上完美运行。

我正在使用 gtkbuilder 加载我的布局。(如果它很重要)

route_input <- builderGetObject builder castToComboBox "route"
comboBoxSetModelText route_input
comboBoxAppendText route_input "first"
comboBoxAppendText route_input "second"
comboBoxAppendText route_input "third"
t <- listStoreToList =<< comboBoxGetModelText route_input
putStrLn $ show t

印刷:

["first","second","third"]

在窗口中,它显示了一个包含三个条目的组合框,它们都是空白的。我点击“确定”按钮,它在其信号处理程序中运行以下代码:

t <- listStoreToList =<< comboBoxGetModelText cbox
putStrLn $ show t
selection <- comboBoxGetActiveText cbox
putStrLn $ show selection

印刷:

["first","second","third"]
Nothing

有人对此有任何想法吗?

4

1 回答 1

0

好的,事实证明这是一个包版本问题。Windows 版本中的 gtk 包比 Linux 机器上的版本高一个版本号。那一定是把什么东西弄坏了。

于 2013-12-16T23:24:15.637 回答