[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

RE: gtk_entry problem in a gtk_dialog



I don't see any problem in the code ? I hope you are not doing
"gtk_widget_destroy ( prefs_window );" in the "else" part of the code ?
If NO the code should get back to the dialog "prefs". If YES we have to
have as follows :

,.......
,.......
,.......

if ( (! extract_path ) || ( ! strlen ( extract_path ) ) ) 
{
	response = ShowGtkMessageDialog (GTK_WINDOW 
(MainWindow),GTK_DIALOG_MODAL,GTK_MESSAGE_ERROR,GTK_BUTTONS_OK, 
"Please select where to extract files !" ); 

	return ; //NEW

}	
,.......,.......
,.......
After success
,.......
gtk_widget_destroy ( prefs_window );

}//End "on_extract1_activate" function	

I hope I am on the right track !!

-----Original Message-----
From: gtk-app-devel-list-bounces gnome org
[mailto:gtk-app-devel-list-bounces gnome org] On Behalf Of Colossus
Sent: Thursday, June 30, 2005 5:30 PM
To: gtk-app-devel-list gnome org
Subject: gtk_entry problem in a gtk_dialog


Hi,

I have a gtk_dialog with a gtk_entry and a button. Before clickink Ok
the user must supply a filename in the gtk_entry. The problem: if the
user doesn't do this I have a gtk_message_dialog appears with an error
message but to give control again to the 
gtk_dialog ? The execution of the code goes on !! This is the code:


void on_extract1_activate ( GtkMenuItem *menuitem, gpointer user_data) {
	static GtkWidget *prefs_window = NULL;
	gchar *command;
	const gchar *extract_path = NULL;
	
	GtkTreeSelection *selection = gtk_tree_view_get_selection ( 
GTK_TREE_VIEW (treeview1) );
	gint selected = gtk_tree_selection_count_selected_rows (
selection );
	prefs_window = prefs (selected);//Here I create the dialog
	
	gtk_dialog_set_default_response (GTK_DIALOG (prefs_window), 
GTK_RESPONSE_OK);
	response = gtk_dialog_run ( GTK_DIALOG ( prefs_window ) );
	if ( response == GTK_RESPONSE_CANCEL || response == 
GTK_RESPONSE_DELETE_EVENT )
	{
		gtk_widget_destroy ( prefs_window );
		return;
	}
	else
	{
		extract_path = gtk_entry_get_text ( GTK_ENTRY (entry1)
);
		if ( (! extract_path ) || ( ! strlen ( extract_path ) )
) response = 
ShowGtkMessageDialog (GTK_WINDOW 
(MainWindow),GTK_DIALOG_MODAL,GTK_MESSAGE_ERROR,GTK_BUTTONS_OK, 
"Please select where to extract files !" );
		
// The execution of the code goes here, how can I give control again 
to the gtk_dialog ??
-- 
Colossus

Cpsed, a Linux OpenGL 3D scene editor http://cpsed.sourceforge.net/

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]