Gtker
Gtker

Reputation: 2247

How do I control widgets added later with gtk in c?

func1();
func2();
...

In func1 there is a button widget,and in func2 a textview widget.(Both calls gtk_box_pack_start to add widgets to the window, so the order can't be changed.)

I want to operate textview when I click on button widget.

But at the time I define the callback,textview is not available yet.

How can I work around this?

Upvotes: 0

Views: 55

Answers (2)

ptomato
ptomato

Reputation: 57870

First create your widgets, then pack them together, then connect your signals.

Upvotes: 1

Lothar
Lothar

Reputation: 13065

So why adding a function func3() in which you connect the signals ?

Upvotes: 0

Related Questions