Re: [anjuta-list] Anjuta Help
- From: Sébastien Granjoux <seb sfo free fr>
- To: Reuben Rissler <silrep emypeople net>, anjuta-list gnome org
- Subject: Re: [anjuta-list] Anjuta Help
- Date: Thu, 20 Aug 2015 23:15:38 +0200
Hi,
Le 19/08/2015 03:20, Reuben Rissler a écrit :
I am a budding noob of a programmer. I would like to create an
application in Anjuta using GTK and C with three boxes and a button. I
figured out all the gui stuff but I am stalled at the signal handlers.
If I send you my project, could you hook them up for me to get me
started?
No, you cannot send attachment on a mailing list, but your program is
quite simple, you can find lots of example. You can use the project
wizard GTK template.
First, you have to write a callback function called when your button is
clicked something like
static void
on_sum_button_clicked (GtkButton *button, void *user_data)
{
...
}
This function has to get the data from both boxes, make the sum and set
the third box. Typically, you use the second argument user_data to sent
it all useful information, by example the address of the three boxes in
a structure.
Then you have to connect this function to your button,
g_signal_connect (G_OBJECT (sum_button), "clicked",
G_CALLBACK (on_sum_button_clicked),
user_data);
This has to be done when you create your dialog, at that moment you can
create the user_data with the address of all boxes.
The easiest way to create a dialog is to use a glade file, you can load
it using gtk_builder_add_from_file and then get all widgets by their
name using gtk_builder_get_object.
Regards,
Sébastien
[
Date Prev][Date Next] [
Thread Prev][Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]