Quantcast
Viewing all articles
Browse latest Browse all 25

Unable to get height/width of a widget - gtkmm

I'm writing an application using gtkmm.

I wrote a simple widget class, that I want to display in the application's main window only in some cases. Otherwise, I would like a Label "disabled" to be visible.

To achieve that I packed both the widget and the label into one VBox, and I show() and hide() them in order to swap them.

However, the custom widget is far larger than the label, so I need to resize the label a bit.

I know I can use label.set_size_request(x,y), and it works, when I type the dimensions manually. But I am aware, that the widget may differ in size a bit, depending on the Gtk theme one uses, etc.

I'd love to set labelexactly the same size *as the widget has. However, using widget.get_height()* does not work- it always returns 1.


Maybe a clue will be that I do this from within the main window's constructor.


Viewing all articles
Browse latest Browse all 25

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>