How can I change pointer to a grid during run time

I want to be able to change the pointer of the gtkmm grid during the run time of the application.

When going through the gtkmm documentation, I am across this statement in the here

Note
If get_widget_derived() is called more than once for the same widget (the same name), only the first call will call the widget’s constructor. The following calls will return a pointer to the widget instance that was constructed by the first call.

GridPointers

I want to be able to change the pointer being passed to the grid, base on a value the user selected by the user during run time from another widget lets say a value from a gtk combo box drop list.

Is this possible? Or do we have a work around for this?

I do have widgets inside the Grid who’s pointers should also change depending on the gtk combo box drop list value selected by the user.

Have you already made some progress?

I saw your question already some days ago, but I am not using C++, and I was not really sure about your intent. Generally, when using Gtk, we do not “set” pointers. We use functions to populate container widgets with other widgets, or other functions to remove child widgets from containers or to replace widgets. We may also hide widgets. There are really a lot of functions available, which one you really have to use depends on your actual task. My guess is that you want to replace a GtkGrid with another one, or maybe you want to modify cells of the Grid only? Maybe what you want is the GtkStack container, which is a Widget with multiple “pages”. A minimal, compileable example may be helpful to express your actual intent. And you may tell us if you use Gtk4 or still older releases.

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