سؤال

I just started using gtk2hs (gtk3 on hackage) and have run into some issues with comboBoxes. I cannot make a simple comboBoxNewText display its strings. I have commented out everything unneeded in my application so I just have a basic framework for the actual box.

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

Am I missing something? gtk3 is marked as unstable iirc on hackage, could this be a bug? Or am I just doing something incorrectly? Adding comboBoxSetActive cb 0 doesn't help either. To clarify, the actual combobox appears when I run the program, but it doesn't contain any strings/is blank. evernote image

هل كانت مفيدة؟

المحلول

As Daniel Wagner commented, this does seem to be a bug in the gtk3 package on hackage. It was fixed with the commit attached to the issue linked https://github.com/gtk2hs/gtk2hs/issues/10

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top