Disable changing active index by mouse scrolling on GtkComboBox

for disabling active element changing in GtkComboBox, in GTK3, i used

GtkWidget* combo = (GtkComboBoxText*)gtk_combo_box_text_new();
g_signal_connect( combo, "scroll-event", G_CALLBACK(gtk_true), NULL );

In GTK4, I’ve tried the below:

GtkEventController * const controller = gtk_event_controller_scroll_new( GTK_EVENT_CONTROLLER_SCROLL_VERTICAL );
GtkWidget * const mywidget = gtk_combo_box_text_new();
if( g_signal_connect( G_OBJECT(controller), "scroll", G_CALLBACK( my_gtk_true ), NULL ) <= 0 ) 
          append_log( ERRNO_ERROR_MSG, "Unable to connect scroll event" );
gtk_widget_add_controller( mywidget, controller );

still active element is changing if I scroll mouse on the combo box. But this code is working fine with GtkSpinButton.

Can some one help me understand how to disable changing active value of the combo box if mouse is scrolled on it…

This topic was automatically closed 45 days after the last reply. New replies are no longer allowed.