Add itens in Combo-box
- From: Jano Crema <jano bhquality com br>
- To: Devel-Lista-GTK <gtk-devel-list gnome org>
- Subject: Add itens in Combo-box
- Date: Wed, 5 Dec 2001 11:06:11 +0000
I have a interface.c where the combo_box was created,
So.. How can I add itens to this same combo_box in the callbacks.c .
I intend doesn't change the interface.c created by Glade.
OTHE QUESTION:
What event I want to create in combo to refer in callbacks file ?
My main question is for example:
I have a windows with entrys and combos and buttons
I put the text on entrys and click and save button,
The button calls on_btn_save function in callbacks.
This function connect to mysql database and save the entrys.
The code below is correct?
It is work very well, but I think is redundance in Objects
Thanks - Jano - Curitiba - Brasil
--------------------------------------------------------------------------
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <mysql/mysql.h>
#include <gnome.h>
#include "callbacks_cc.h"
#include "interface.h"
#include "support.h"
MYSQL mysql;
MYSQL_RES *resultado;
MYSQL_ROW linha;
GtkWidget *codigo;
GtkWidget *descricao;
char query[200];
char *cod, *desc;
void
on_btn_gravar_clicked (GtkButton *button,
gpointer user_data)
{
mysql_init(&mysql);
mysql_real_connect(&mysql,"200.xxx.xxx.xxx","user","pass","db",0,NULL,0);
codigo=lookup_widget(GTK_WIDGET(button), "txtcodigo");
descricao=lookup_widget(GTK_WIDGET(button), "txtdescricao");
cod=gtk_entry_get_text(GTK_ENTRY(codigo));
desc=gtk_entry_get_text(GTK_ENTRY(descricao));
sprintf(query, "insert into centrodecusto values('%s', '%s')",cod, desc);
mysql_query(&mysql, query);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]