Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.0k views
in Technique[技术] by (71.8m points)

linux - Gtk. Can't get HdyClamp object through GtkBuilder in C

I have the following HdyClamp declaration in a .ui file. HdyClamp is defined in the libhandy api. see here

 .......

 <object class="HdyClamp" id="cl">
            <property name="visible">True</property>
            <property name="can-focus">False</property>
            <child>
 .......

Since HdyClamp is also a GtkWidget, I thought I should be able to get this object through GtkBuilder and store it in a GtkWidget object. Here is the code.

 GtkWidget * clamp = GTK_WIDGET(gtk_builder_get_object(builder, "cl"));

Where builder is a GtkBuilder object associated with the .ui file. The result is that clamp is NULL after that line which means gtk_builder_get_object() failed to return the HdyClamp object with the given ID cl. I am really not sure why this happens and would greatly appreciate the help.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The issue is fixed, see the comments under the post.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...