GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Thu Oct 02, 2014 12:22 am

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: window instance problem
PostPosted: Thu Apr 12, 2007 4:04 am 
Offline

Joined: Wed Apr 11, 2007 11:47 am
Posts: 3
sorry friend, i will explain my problem with code

i create windwo using
GtkWidget *window1;
window1 = gtk_window_new (GTK_WINDOW_TOPLEVEL);

creating two buttons , one button callbacks like this

on_button1_clicked (GtkButton *button,
gpointer user_data)
{
window1 = create_window1();
gtk_widget_show (window1);
}
and second button callbacks like this
void
on_button2_clicked (GtkButton *button,
gpointer user_data)
{
gtk_widget_destroy(window1));
}

when i press first button more than one time somany windows are opend
at that time i press second button only one window will close remaing windows are
same?

so how can i solve that one?
can u help na
bye
Manju


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 12, 2007 2:54 pm 
Offline

Joined: Sat Mar 24, 2007 8:53 am
Posts: 3
Your problem is not very clear...

Is this what you want the buttons to do?
button1 - show the window
button2 - close the window


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 12, 2007 4:41 pm 
Offline
Never Seen the Sunlight

Joined: Wed Sep 21, 2005 12:07 am
Posts: 563
Location: Portland, OR USA
Code:
GtkWidget *window1 = NULL;
window1 = gtk_window_new (GTK_WINDOW_TOPLEVEL);

on_button1_clicked (GtkButton *button,
gpointer user_data)
{
  if (window1 == NULL)
  {
    window1 = create_window1();
    gtk_widget_show (window1);
  }
}

void
on_button2_clicked (GtkButton *button,
gpointer user_data)
{
  if (window1 != NUL) gtk_widget_destroy(window1));
}

_________________
Micah Carrick - Forum Administrator
http://www.micahcarrick.com


Top
 Profile  
 
 Post subject: thanks for ur response
PostPosted: Fri Apr 13, 2007 5:12 am 
Offline

Joined: Wed Apr 11, 2007 11:47 am
Posts: 3
thank u very much


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group