How to make the ColorChooser launched by a ColorButton a modal window

I have a ColorButton that launches an otherwise perfectly fine ColorChooser. The problem I’m facing is that the user can still interact with the main window while the chooser is open. If only I could make the chooser a modal window that would solve the problem, but that doesn’t seem to be part of the configuration options of the button.

Other options I have considered:

  • Style a normal button and make it launch the ColorChooser as modal (with the drawback of me having to style a button to look like the ColorButton)
  • Prevent the ColorButton from launching its ColorCooser and make it launch mine (as modal). But I’m not sure still how to prevent the ColorChooser of a ColorButton from being launched.

Do ye know what are my best alternatives for this? Teşekkürler!

Is porting to GTK4 a realistic option? ColorButton has a modal property there to control whether the dialog window should be modal or not.

Hi @fmuellner , that might be a good idea actually. Do you know if I can still use the same xml file I created with Glade to build the UI?

Yes in the sense that building the UI from XML files with GtkBuilder/templates is still possible, and the XML format hasn’t changed as far as I know.

But it is very unlikely that you can use the unchanged file, because of differences between GTK3 and GTK4. Widgets have different properties, support different custom elements (like <titlebar> in GtkWindow), child properties (<packing>) are gone, …

There is a tool called gtk4-builder-tool that can help with the conversion.

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