私は Glade の初心者ですが、C プログラミングの経験があります。
2 つの値を受け入れて合計を表示するプロジェクトを構築しようとしています。
私は以下を使用しました:
textbox1 - (entry1) ---- for first value,
textbox2 - (entry2) ---- for 2nd value,
textbox3 - (entry3) ---- to display result,
button - (button1) ---- to calculate sum,
signal - (on_button1_clicked) ---- to handle sum function.
信号コードを教えてください。
#include <gtk/gtk.h>
#include <stdio.h>
GtkBuilder *builder;
GtkWidget *window;
GError *error = NULL;
void on_button1_clicked
{
// Need Help in this section
}
void on_window1_destroy (GtkObject *object, gpointer user_data)
{
gtk_main_quit();
}
int main( int argc, char **argv )
{
/* Init GTK+ */
gtk_init( &argc, &argv );
/* Create new GtkBuilder object */
builder = gtk_builder_new();
/* Load UI from file. If error occurs, report it and quit application.
* Replace "tut.glade" with your saved project. */
if( ! gtk_builder_add_from_file( builder, "sum.glade", &error ) )
{
g_warning( "%s", error->message );
g_free( error );
return( 1 );
}
/* Get main window pointer from UI */
window = GTK_WIDGET( gtk_builder_get_object( builder, "window1" ) );
/* Connect signals */
gtk_builder_connect_signals( builder, NULL );
/* Destroy builder, since we don't need it anymore */
g_object_unref( G_OBJECT( builder ) );
/* Show window. All other widgets are automatically shown by GtkBuilder */
gtk_widget_show( window );
/* Start main loop */
gtk_main();
return( 0 );
}