Hello,
Since GTK4 labels are no longer focusable, however I have found focusable labels in the wild and I am trying to learn how to make the label focusable with the keyboard and allow text selection.
I am looking at two examples.
Within the gnome-podcasts app there is a label holding the podcast episode description which is focusable and text can be selected and copyed.
That label is described inside the ui file like this.
<object class="GtkLabel" id="description">
<property name="valign">start</property>
<property name="margin-start">18</property>
<property name="margin-end">18</property>
<property name="margin-bottom">18</property>
<property name="label" translatable="yes">Episode Description</property>
<property name="wrap">True</property>
<property name="wrap-mode">word-char</property>
<property name="xalign">0</property>
<style>
<class name="episode_description_label"/>
</style>
</object>
In the shortwave app there is a label wit the currently playing track title. This one is not focusable with the keyboard and the text can’t be selected.
It’s described inside the ui file like this.
<object class="GtkLabel" id="track_label">
<property name="margin_top">6</property>
<property name="justify">center</property>
<property name="ellipsize">end</property>
<property name="wrap">True</property>
<property name="lines">2</property>
<binding name="label">
<lookup name="title" type="SwTrack">
<lookup name="playing-track" type="SwPlayer">
<lookup name="player">SwPlayerView</lookup>
</lookup>
</lookup>
</binding>
</object>
Please can you help me to understand this?
Does it something to do with these labels, or is relation to the other widgets important here?
Thanks and greetings
Peter