re: dialogs problems
- From: Juan Pablo <jpdborgna yahoo com ar>
- To: gtk-app-devel-list gnome org
- Subject: re: dialogs problems
- Date: Thu, 19 Jan 2006 09:57:34 -0300
Ok, im sending some source code so its easy to see:
This is the main menu callback, it opens the first dialog:
void on_prov_admin_activate (GtkMenuItem *menuitem, gpointer
user_data)
{
gtk_widget_show(create_prov_admin_dlg());
}
This is a callback from a button inside prov_admin_dlg:
void on_prov_admin_edit_clicked (GtkButton *button,
gpointer user_data)
{
gint selected;
GnomeDbGrid *grid;
GtkWidget *dialog;
grid=GNOME_DB_GRID(lookup_widget(GTK_WIDGET(button),"prov_dbgrid"));
/* Si no hay seleccion, salir */
if ((selected=gnome_db_grid_get_selected(grid))<0)
return;
boa_fe.editing=TRUE; /* Global flag */
boa_fe.id=gnome_db_grid_get_selected_id(grid); /* Global ID */
dialog=create_new_prov();
ret=gtk_dialog_run(GTK_DIALOG(dialog)); /* Block on edit dialog */
gtk_widget_destroy(dialog);
boa_fe.editing=FALSE;
fill_prov_dbgrid(GTK_WIDGET(button)); /* Refresh the dbgrid*/
}
That opens the second dialog (third window).
And inside new_prov dialog, I have this callback, wich is from the
"Save" button:
void on_new_prov_save_clicked (GtkButton *button, gpointer user_data)
{
GdaCommand *cmd;
gchar *buffer;
gint rows;
gint p_id, iva_id;
const gchar *cuit;
gchar *nombre;
GdaDataModel *recset;
cuit=gtk_entry_get_text(GTK_ENTRY(lookup_widget(GTK_WIDGET(button),"new_prov_cuit")));
nombre=g_strdup(gtk_entry_get_text(GTK_ENTRY(lookup_widget(GTK_WIDGET(button),"new_prov_nombre"))));
g_strchomp(nombre);
if (g_utf8_strlen(nombre,40)==0)
{
messagebox("Debe ingresar un nombre."); /* <<--------------- Here
is the problem !!!! */
gtk_widget_grab_focus(lookup_widget(GTK_WIDGET(button),"new_prov_nombre"));
return;
}
. . .
gda_command_free (cmd);
g_free(buffer);
}
Messagebox is this:
void messagebox(gchar *msg)
{
GtkWidget *dialog;
dialog = gtk_message_dialog_new_with_markup (NULL,
GTK_DIALOG_MODAL,
GTK_MESSAGE_QUESTION,
GTK_BUTTONS_OK,
msg,
NULL);
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy(dialog);
}
Ok thats the source.
The problem is that when closing that last dialog from messagebox, the
new_prov dialog closes too and (i have experimented) returns the
response of messagebox.
The idea was to warn the user of a blank field and return so he can fill it.
Thanks all.
Saludos, Juan Pablo.
___________________________________________________________
1GB gratis, Antivirus y Antispam
Correo Yahoo!, el mejor correo web del mundo
http://correo.yahoo.com.ar
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]