The documentation says:
Usually you want to pass Nothing for the adjustments
but
scrolled <- scrolledWindowNew Nothing Nothing
gives me the following error, probably caused by incorrect imports.
• Overlapping instances for GI.Gtk.Objects.Adjustment.IsAdjustment
a0
arising from a use of ‘scrolledWindowNew’ Matching instances:
instance [overlappable] (Data.GI.Base.BasicTypes.GObject a,
Data.GI.Base.Overloading.UnknownAncestorError
GI.Gtk.Objects.Adjustment.Adjustment a) =>
GI.Gtk.Objects.Adjustment.IsAdjustment a
-- Defined in ‘GI.Gtk.Objects.Adjustment’
...plus one instance involving out-of-scope types
(use -fprint-potential-instances to see them all)
my imports look like this
import qualified GI.Gtk as GI (init,
main)
import GI.Gtk (mainQuit,
onWidgetDestroy,
windowNew,
widgetShowAll,
containerSetBorderWidth,
headerBarNew, headerBarSetTitle, headerBarSetSubtitle,headerBarSetShowCloseButton,
scrolledWindowNew
)
import GI.Gtk.Objects.Window
import GI.Gtk.Enums
a possible solution
Is it an error in the documentation? Using noAdjustment instead of Nothing seems to work.
import qualified GI.Gtk as GI (init,
main)
import GI.Gtk (mainQuit,
onWidgetDestroy,
windowNew,
widgetShowAll,
containerSetBorderWidth,
headerBarNew, headerBarSetTitle, headerBarSetSubtitle,headerBarSetShowCloseButton,
scrolledWindowNew, scrolledWindowSetPolicy
)
import GI.Gtk.Objects.Window
import GI.Gtk.Objects.Adjustment (noAdjustment)
import GI.Gtk.Enums (WindowType(..), PolicyType(..))
scrolled <- scrolledWindowNew noAdjustment noAdjustment
scrolledWindowSetPolicy scrolled PolicyTypeNever PolicyTypeAutomatic
Inspiration found in Leksah source code.
please comment
I was trying to translate into Haskell a Python example found here: http://python-gtk-3-tutorial.readthedocs.io/en/latest/layout.html#flowbox
Working version, with the problem solved, can be found here: https://github.com/bigos/my-haskell-gtk-3-tutorial/blob/master/5-layout-containers/6-flow-box.org