Re: Button events

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Feb 18, 2014 at 09:44:10AM +0000, Bill Vyzas wrote:
> I have created a couple of interfaces I want for my project, two gtk tree
> view and two gtk list store. In all these interfaces the view and the model
> changes, some have less columns and rows than the others. I want to be able
> to interact with all the interfaces with a series of buttons I created.
> What is the best way to do that? Apparently callback function don't work
> properly in this case.

Why exactly they should not work?

> In my experience from Java I could use the ActionPerformed method and have
> the button respond to any events happening. Can I do something similar in
> gtk? Like
> if(button1 == clicked){
>      call_function1();
> }else{
>      call_function2();
> }

What is the else part?  Something else happened with button1, some other
button was clicked, anything whatsoever happened like the pointer was
moved, ...?

Instead of writing ifs, attach one callback function to "clicked" of
button1 and another callback to whatever signal is the else part.

If handing of some signals is so generic that you really want a common
handler passing the specific info in the callback data when you connect
the handlers.  If you need to distinguish the widgets that have received
the signa, this can be done by using their name or by attaching extra
info to them using g_object_set_data().

Yeti

_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
https://mail.gnome.org/mailman/listinfo/gtk-list




[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux