Printable Version of Topic

Click here to view this topic in its original format

Linuxhelp _ Programming in Linux _ Looking For Help With Glade

Posted by: spiroth10 Jul 29 2004, 11:40 PM

well, my linux isnt working now, but I need help anyway. I can build the progs and everything, but one small thing: how do you call a function when a button is pressed???

its very different from any of the other RADs Ive used... I designed an interface, but I cant figure out how to do an if() statement (Im using c, not c++... not a c++ fan really) to call what happens when a button is pressed, making it virtually useless for me... sad.gif

in last (windows) rad (the only free one ive found), its something like if(hwndCtl_Nameoffunction){}
where name of function you put button1 or whatever else. Im pretty sure its similar, and once i get it, I can easily develop applications using it.

Posted by: Hemant Jul 30 2004, 04:35 AM

It is really simple..
There are two approaches for doing GTK programming using glade.
1.Start glade...create the interface.And connect the callbacks(just a loose will have to write the whole function by hand).For creating callbacks for a button.add button to your interface.and then in the property window look for tab called "signal".and click on the ellipsis button for getting an event for the button click.the event is called "clicked".now a optional callback will be associated with that event.just save the glade file..and click on the "build" button.
So all the sources will be created for you.Now look for a file called callbacks.c and there your callback will be can write your code there.this code will be executed when the button will be clicked.
2.The other way is almost same till creating the interface.But don't click the build button.Just save the project as a .glade file.Now open a main.c file...use libglade file for adding the .glade file.for details of this procedure...checkout /usr/share/gtk-doc/libglade.
This method is considered more powerful and most of the huge gnome projects are created using this method only.

Powered by Invision Power Board (
© Invision Power Services (