Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi monks,

I encounter a problem with the ComboBox-widget in Gtk2-perl. I have the suspicion that the problem is installation specific and due to the underlying C-API or a version mismatch between the C-library and the binding, resp. (I get no warnings or error messages from Perl).

So, the demo code below might run properly on other systems.

When executed, the window containing the combobox pops up with no item selected. It is then possible to select an arbitrary item from the list ( "AAA", "BBB", "CCC"). But, once an item is selected, it is not possible to select a different item any more. The ComboBox seems to be kind of "frozen".

Indeed, during the installation of Gtk2-Perl, make test came up with quite a lot of warnings/errors (probably too much to use the installation for production purposes; maybe one of You folks has an explanation / a suggestion with respect to this). In particular there was a critical error for the test script GtkComboBox.t:

t/GtkComboBox......................Gtk-CRITICAL **: gtk_tree_model_get +_path: assertion `iter != NULL' failed at t/GtkComboBox.t line 38. ok

Any suggestions are appreciated.

My environment:

Perl: 5.8.8

Glib: 1.260

Gtk2: 1.270

OS: Red Hat 4.1.2-46 (Kernel: 2.6.18-164.el5)

The demo code:

#!/usr/bin/perl use strict; use warnings; use diagnostics; use Gtk2 -init; my $mw = Gtk2::Window->new(); $mw->signal_connect( 'delete_event' => sub { Gtk2->main_quit; } ); my $cb = Gtk2::ComboBox->new_text(); my @items = qw( AAA BBB CCC ); foreach ( @items ) { $cb->append_text( $_ ); } $mw->add( $cb ); $mw->show_all; Gtk2->main();

The "make test" output:

PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_h +arness(0, 'blib/lib', 'blib/arch')" t/*.t t/00.Gtk2..........................# Testing Gtk2 1.244 # Running against gtk+ 2.10.4 # Compiled against gtk+ 2.10.4 # and pango 1.14.9 ok t/01.GtkWindow.....................ok 11/120 skipped: various reasons t/02.GtkContainer..................ok 2/41 skipped: new 2.14 stuff t/Gdk..............................ok t/GdkCairo.........................ok 2/6 skipped: new 2.22 stuff t/GdkColor.........................ok 1/18 skipped: new 2.12 stuff t/GdkCursor........................ok 1/9 skipped: new 2.22 stuff t/GdkDisplay.......................ok 2/26 skipped: various reasons t/GdkDisplayManager................ok t/GdkDnd...........................ok 14/26 skipped: various reasons t/GdkDrawable......................ok t/GdkEvent.........................ok 3/123 skipped: various reasons t/GdkGC............................ok t/GdkImage.........................ok t/GdkInput.........................ok 6/20 skipped: new 2.22 stuff t/GdkKeys..........................ok 4/46 skipped: various reasons t/GdkPango.........................ok 4/14 skipped: 2.12 stuff t/GdkPixbuf........................ok t/GdkPixbufLoader..................ok t/GdkPixbufSimpleAnim..............ok 1/131 skipped: new 2.18 stuff t/GdkPixmap........................ok t/GdkProperty......................ok t/GdkRegion........................ok 1/35 skipped: new 2.18 stuff t/GdkRgb...........................ok t/GdkScreen........................ok 6/27 skipped: various reasons t/GdkSelection.....................ok t/GdkVisual........................ok 8/32 skipped: new 2.22 stuff t/GdkWindow........................The program 'GdkWindow.t' received +an X Window System error. This probably reflects a bug in the program. The error was 'BadWindow (invalid Window parameter)'. (Details: serial 159 error_code 3 request_code 12 minor_code 0) (Note to programmers: normally, X errors are reported asynchronously +; that is, you will receive the error a while after causing it. To debug your program, run it with the --sync command line option to change this behavior. You can then get a meaningful backtrace from your debugger if you break on the gdk_x_error() func +tion.) dubious Test returned status 1 (wstat 256, 0x100) DIED. FAILED tests 9-58 Failed 50/58 tests, 13.79% okay t/GdkX11...........................ok 2/14 skipped: various reasons t/GtkAboutDialog...................ok 4/34 skipped: new 2.12 stuff t/GtkAccelGroup....................ok 2/19 skipped: new 2.14 stuff t/GtkAccelLabel....................ok t/GtkAccelMap......................ok t/GtkAction........................ok 15/31 skipped: various reasons t/GtkActionGroup...................ok t/GtkActivatable...................skipped all skipped: Gtk2::Activatable is new in 2.16 t/GtkAdjustment....................# Looks like you planned 25 tests b +ut only ran 19. dubious Test returned status 255 (wstat 65280, 0xff00) DIED. FAILED tests 20-25 Failed 6/25 tests, 76.00% okay (less 5 skipped tests: 14 okay, 56. +00%) t/GtkAlignment.....................ok t/GtkArrow.........................ok t/GtkAspectFrame...................ok t/GtkAssistant.....................ok t/GtkBin...........................ok t/GtkBindings......................ok 8/43 skipped: entry_skip() new in 2.12 t/GtkBox...........................ok t/GtkBuildable.....................skipped all skipped: GtkBuildable: it appeared in 2.12 t/GtkBuildableIface................skipped all skipped: GtkBuildable appeared in 2.12 t/GtkBuilder.......................skipped all skipped: GtkBuildable: it appeared in 2.12 t/GtkButton........................ok 1/40 skipped: new 2.22 stuff t/GtkButtonBox.....................ok t/GtkCalendar......................ok 7/18 skipped: new 2.14 stuff t/GtkCellEditable..................ok t/GtkCellLayout....................ok 1/5 skipped: 2.12 stuff t/GtkCellLayoutIface...............ok 4/31 skipped: get_cells t/GtkCellRenderer..................ok 6/26 skipped: new 2.18 stuff t/GtkCellRendererAccel.............ok t/GtkCellRendererCombo.............ok t/GtkCellRendererIface-Chaining....ok t/GtkCellRendererPixbuf............ok t/GtkCellRendererProgress..........ok t/GtkCellRendererSpin..............ok t/GtkCellRendererSpinner...........skipped all skipped: Gtk2::CellRendererSpinner is new in 2.20 t/GtkCellRendererText..............ok t/GtkCellRendererToggle............ok 1/4 skipped: new 2.18 stuff t/GtkCellView......................Gtk-CRITICAL **: gtk_cell_view_set_ +model: assertion `GTK_IS_TREE_MODEL (model)' failed at t/GtkCellView. +t line 44. ok 2/12 skipped: new 2.16 stuff t/GtkCheckButton...................ok t/GtkCheckMenuItem.................ok t/GtkClipboard.....................ok 5/115 skipped: new uris stuff t/GtkColorButton...................ok t/GtkColorSelection................ok t/GtkColorSelectionDialog..........ok t/GtkCombo.........................ok t/GtkComboBox......................Gtk-CRITICAL **: gtk_tree_model_get +_path: assertion `iter != NULL' failed at t/GtkComboBox.t line 38. ok 1/28 skipped: new 2.14 stuff t/GtkComboBoxEntry.................ok t/GtkCurve.........................ok t/GtkDialog........................ok 2/33 skipped: get_widget_for_response is new in 2.20 t/GtkDnd...........................ok t/GtkDrawingArea...................ok t/GtkEditable......................ok t/GtkEntry.........................ok 57/76 skipped: various reasons t/GtkEntryBuffer...................skipped all skipped: no reason given t/GtkEntryCompletion...............ok 2/12 skipped: new 2.12 stuff t/GtkEventBox......................ok t/GtkExpander......................ok 1/15 skipped: new 2.22 stuff t/GtkFileChooser...................skipped all skipped: this test is unreliable t/GtkFileChooserButton.............ok t/GtkFileChooserDialog.............ok t/GtkFileChooserWidget.............ok t/GtkFileFilter....................ok t/GtkFileSelection.................ok t/GtkFixed.........................ok t/GtkFontButton....................ok t/GtkFontSelection.................ok 9/23 skipped: various reasons t/GtkFrame.........................ok t/GtkGammaCurve....................ok t/GtkGC............................ok t/GtkHandleBox.....................ok t/GtkHBox..........................ok t/GtkHButtonBox....................ok t/GtkHPaned........................ok t/GtkHRuler........................ok t/GtkHScale........................ok t/GtkHScrollbar....................ok t/GtkHSeparator....................ok t/GtkHSV...........................skipped all skipped: Gtk2::HSV is new in 2.14 t/GtkIconFactory...................ok t/GtkIconTheme.....................ok 3/17 skipped: various reasons t/GtkIconView......................ok 11/60 skipped: various reasons t/GtkImage.........................ok t/GtkImageMenuItem.................ok 5/12 skipped: use_stock methods t/GtkIMContext.....................ok 2/9 skipped: 2.16 additions t/GtkInfoBar.......................skipped all skipped: no reason given t/GtkInputDialog...................ok t/GtkInvisible.....................ok t/GtkItemFactory...................ok t/GtkLabel.........................ok 2/32 skipped: new 2.18 stuff t/GtkLayout........................ok t/GtkLinkButton....................ok 1/28 skipped: new 2.14 stuff t/GtkListStore.....................ok t/GtkMenu..........................String found where operator expecte +d at t/GtkMenu.t line 183, near "note "popup position runs=$popup_run +s warn='$saw_warning'"" (Do you need to predeclare note?) syntax error at t/GtkMenu.t line 183, near "note "popup position runs= +$popup_runs warn='$saw_warning'"" Execution of t/GtkMenu.t aborted due to compilation errors. # Looks like your test died before it could output anything. dubious Test returned status 255 (wstat 65280, 0xff00) DIED. FAILED tests 1-66 Failed 66/66 tests, 0.00% okay t/GtkMenuBar.......................ok t/GtkMenuItem......................ok 5/20 skipped: various reasons t/GtkMenuShell.....................ok t/GtkMenuToolButton................ok t/GtkMessageDialog.................ok 2/8 skipped: various reasons t/GtkMisc..........................ok t/GtkNotebook......................ok 3/66 skipped: various reasons t/GtkObject........................ok t/GtkOffscreenWindow...............skipped all skipped: Gtk2::OffscreenWindow is new in 2.20 t/GtkOptionMenu....................ok t/GtkOrientable....................skipped all skipped: GtkOrientable: it appeared in 2.16 t/GtkPageSetup.....................ok 12/23 skipped: various reasons t/GtkPaned.........................ok 1/10 skipped: new 2.20 stuff t/GtkPaperSize.....................ok 4/20 skipped: new 2.12 stuff t/GtkPrintContext..................ok 1/11 skipped: new 2.20 stuff t/GtkPrintOperation................ok 7/17 skipped: various reasons t/GtkPrintOperationPreview.........ok t/GtkPrintSettings.................ok 15/23 skipped: various reasons t/GtkProgressBar...................ok t/GtkRadioAction...................ok t/GtkRadioButton...................ok t/GtkRadioMenuItem.................ok t/GtkRadioToolButton...............ok t/GtkRange.........................ok 8/15 skipped: various reasons t/GtkRc............................ok t/GtkRecentAction..................skipped all skipped: GtkRecentAtionc: new in 2.12 t/GtkRecentChooser.................Gtk-WARNING **: Failed to add file +monitor on './test.xbel' at t/GtkRecentChooser.t line 10. ok t/GtkRecentChooserDialog...........ok t/GtkRecentChooserMenu.............ok t/GtkRecentChooserWidget...........ok t/GtkRecentFilter..................ok t/GtkRecentManager.................Gtk-WARNING **: Failed to add file +monitor on './test.xbel' at t/GtkRecentManager.t line 37. ok t/GtkRuler.........................ok t/GtkScale.........................ok 1/7 skipped: gtk_scale_add_mark and gtk_scale_clear_marks are +new in 2.16 t/GtkScaleButton...................skipped all skipped: GtkScaleButton appeared in 2.12 t/GtkScrolledWindow................ok t/GtkSelection.....................ok t/GtkSeparatorMenuItem.............ok t/GtkSeparatorToolItem.............ok t/GtkShow..........................skipped all skipped: can only test interactively t/GtkSimpleList....................ok t/GtkSimpleMenu....................ok t/GtkSizeGroup.....................ok t/GtkSocket-GtkPlug................The program 'GtkSocket-GtkPlug.t' r +eceived an X Window System error. This probably reflects a bug in the program. The error was 'BadWindow (invalid Window parameter)'. (Details: serial 174 error_code 3 request_code 144 minor_code 1) (Note to programmers: normally, X errors are reported asynchronously +; that is, you will receive the error a while after causing it. To debug your program, run it with the --sync command line option to change this behavior. You can then get a meaningful backtrace from your debugger if you break on the gdk_x_error() func +tion.) dubious Test returned status 1 (wstat 256, 0x100) DIED. FAILED tests 6-12 Failed 7/12 tests, 41.67% okay (less 2 skipped tests: 3 okay, 25.0 +0%) t/GtkSpinButton....................ok t/GtkSpinner.......................skipped all skipped: Gtk2::Spinner is new in 2.20 t/GtkStatusbar.....................ok 1/10 skipped: new 2.20 stuff t/GtkStatusIcon....................ok 9/37 skipped: various reasons t/GtkStock.........................ok t/GtkStyle.........................ok 12/125 skipped: get is new in 2.16 t/GtkTable.........................ok 1/6 skipped: new 2.22 stuff t/GtkTearoffMenuItem...............ok t/GtkTextBuffer....................ok t/GtkTextBufferRichText............ok t/GtkTextChildAnchor...............ok t/GtkTextIter......................ok t/GtkTextMark......................ok 5/11 skipped: new 2.12 stuff t/GtkTextTag.......................ok t/GtkTextTagTable..................ok t/GtkTextView......................ok 3/48 skipped: new 2.22 stuff t/GtkToggleAction..................ok t/GtkToggleButton..................ok t/GtkToggleToolButton..............ok t/GtkToolbar.......................ok t/GtkToolButton....................ok t/GtkToolItem......................ok 4/24 skipped: new 2.20 stuff t/GtkToolItemGroup.................skipped all skipped: Gtk2::ToolItemGroup is new in 2.20 t/GtkToolPalette...................skipped all skipped: Gtk2::ToolPalette is new in 2.20 t/GtkToolShell.....................skipped all skipped: GtkToolShell is new in 2.14 t/GtkTooltip.......................skipped all skipped: GtkTooltip appeared in 2.12 t/GtkTooltips......................ok t/GtkTreeDnd.......................ok t/GtkTreeModel.....................ok t/GtkTreeModelFilter...............ok t/GtkTreeModelIface................ok t/GtkTreeModelSort.................ok t/GtkTreeSelection.................ok t/GtkTreeSortable..................ok t/GtkTreeStore.....................ok t/GtkTreeView-Dnd..................skipped all skipped: this test is interactive t/GtkTreeView......................ok 17/124 skipped: new 2.12 stuff t/GtkUIManager.....................ok t/GtkVBox..........................ok t/GtkVButtonBox....................ok t/GtkViewport......................ok 2/8 skipped: various reasons t/GtkVolumeButton..................skipped all skipped: GtkVolumeButton appeared in 2.12 t/GtkVPaned........................ok t/GtkVRuler........................ok t/GtkVScale........................ok t/GtkVScrollbar....................ok t/GtkVSeparator....................ok t/GtkWidget........................ok 29/158 skipped: various reasons t/pango-compat.....................ok t/PangoAttributes..................ok 16/202 skipped: various reasons t/PangoCairo.......................ok 9/22 skipped: new 1.18 stuff t/PangoContext.....................ok 3/15 skipped: new 1.16 stuff t/PangoFont........................ok 2/57 skipped: various reasons t/PangoFontMap.....................ok t/PangoFontset.....................ok t/PangoGravity.....................ok 4/4 skipped: PangoGravity t/PangoLayout......................ok 6/71 skipped: various reasons t/PangoMatrix......................ok 4/48 skipped: 1.16 stuff t/PangoRenderer....................ok 2/7 skipped: new 1.20 stuff t/PangoScript......................ok t/PangoTabs........................ok t/PangoTypes.......................ok 5/9 skipped: 1.16 stuff t/set-scroll-adjustments-signal....ok t/signal-chaining..................ok t/tied-objects.....................ok t/version-checks...................ok Failed Test Stat Wstat Total Fail Failed List of Failed ---------------------------------------------------------------------- +--------- t/GdkWindow.t 1 256 58 100 172.41% 9-58 t/GtkAdjustment.t 255 65280 25 12 48.00% 20-25 t/GtkMenu.t 255 65280 66 132 200.00% 1-66 t/GtkSocket-GtkPlug.t 1 256 12 14 116.67% 6-12 21 tests and 420 subtests skipped. Failed 4/229 test scripts, 98.25% okay. 129/4838 subtests failed, 97.3 +3% okay. make: *** [test_dynamic] Error 255

Replies are listed 'Best First'.
Re: Gtk2::ComboBox: Cannot be changed after initial selection
by zentara (Cardinal) on Nov 27, 2012 at 18:25 UTC
    Your code works fine for me, I think you need to get the proper version match between the c-libs and the Perl module for Gtk2. Gtk2 is moving to Gtk3, and the last version of the c libs which can still be called Gtk2, is gtk+-2.24.5. After 2.24, it is known as Gtk3, even though it still has a 2.25 numbering. So you might try installing the latest libs, then reinstall the Perl module which corresponds to that lib level.

    If it's any help to you, my latest Gtk2 uses cairo-1.10.2, gdk-pixbuf-2.23.4, glib-2.29.8, glib-networking-2.29.9, pango-1.29.3, atk-2.0.1, and gtk+-2.24.5. There is a specific installation order you must follow, but it is explained on the gtk+ installation website.

    Those libs are compatible, and can be used with the Perl modules: Cairo-1.062, Glib-1.223, Pango-1.221, and Gtk2-1.223.


    I'm not really a human, but I play one on earth.
    Old Perl Programmer Haiku ................... flash japh